mirror of https://gitlab.com/bashrc2/epicyon
Command option to bind to an ip address
parent
caae61d33f
commit
5ce8e1e101
|
@ -643,7 +643,8 @@ def run_daemon(accounts_data_dir: str,
|
||||||
manual_follower_approval: bool,
|
manual_follower_approval: bool,
|
||||||
watermark_width_percent: int,
|
watermark_width_percent: int,
|
||||||
watermark_position: str,
|
watermark_position: str,
|
||||||
watermark_opacity: int) -> None:
|
watermark_opacity: int,
|
||||||
|
bind_to_ip_address: str) -> None:
|
||||||
if len(domain) == 0:
|
if len(domain) == 0:
|
||||||
domain = 'localhost'
|
domain = 'localhost'
|
||||||
if '.' not in domain:
|
if '.' not in domain:
|
||||||
|
@ -657,7 +658,10 @@ def run_daemon(accounts_data_dir: str,
|
||||||
server_address = (domain, proxy_port)
|
server_address = (domain, proxy_port)
|
||||||
pub_handler = partial(PubServerUnitTest)
|
pub_handler = partial(PubServerUnitTest)
|
||||||
else:
|
else:
|
||||||
server_address = ('', proxy_port)
|
if not bind_to_ip_address:
|
||||||
|
server_address = ('', proxy_port)
|
||||||
|
else:
|
||||||
|
server_address = (bind_to_ip_address, proxy_port)
|
||||||
pub_handler = partial(PubServer)
|
pub_handler = partial(PubServer)
|
||||||
|
|
||||||
if accounts_data_dir:
|
if accounts_data_dir:
|
||||||
|
|
|
@ -251,6 +251,9 @@ def _command_options() -> None:
|
||||||
parser.add_argument('-p', '--port', dest='port', type=int,
|
parser.add_argument('-p', '--port', dest='port', type=int,
|
||||||
default=None,
|
default=None,
|
||||||
help='Port number to run on')
|
help='Port number to run on')
|
||||||
|
parser.add_argument('--bind', dest='bind_to_ip_address', type=str,
|
||||||
|
default='',
|
||||||
|
help='Bind the HTTP server to an IP address')
|
||||||
parser.add_argument('--expiryDays', dest='expiryDays', type=int,
|
parser.add_argument('--expiryDays', dest='expiryDays', type=int,
|
||||||
default=None,
|
default=None,
|
||||||
help='Number of days after which posts expire ' +
|
help='Number of days after which posts expire ' +
|
||||||
|
@ -4147,4 +4150,5 @@ if __name__ == "__main__":
|
||||||
not argb2.noapproval,
|
not argb2.noapproval,
|
||||||
argb2.watermark_width_percent,
|
argb2.watermark_width_percent,
|
||||||
argb2.watermark_position,
|
argb2.watermark_position,
|
||||||
argb2.watermark_opacity)
|
argb2.watermark_opacity,
|
||||||
|
argb2.bind_to_ip_address)
|
||||||
|
|
12
tests.py
12
tests.py
|
@ -897,6 +897,7 @@ def create_server_alice(path: str, domain: str, port: int,
|
||||||
watermark_width_percent = 30
|
watermark_width_percent = 30
|
||||||
watermark_position = 'east'
|
watermark_position = 'east'
|
||||||
watermark_opacity = 10
|
watermark_opacity = 10
|
||||||
|
bind_to_ip_address = ''
|
||||||
print('Server running: Alice')
|
print('Server running: Alice')
|
||||||
run_daemon(accounts_data_dir,
|
run_daemon(accounts_data_dir,
|
||||||
no_of_books, public_replies_unlisted,
|
no_of_books, public_replies_unlisted,
|
||||||
|
@ -929,7 +930,7 @@ def create_server_alice(path: str, domain: str, port: int,
|
||||||
domain_max_posts_per_day, account_max_posts_per_day,
|
domain_max_posts_per_day, account_max_posts_per_day,
|
||||||
allow_deletion, True, True, False, send_threads,
|
allow_deletion, True, True, False, send_threads,
|
||||||
False, watermark_width_percent,
|
False, watermark_width_percent,
|
||||||
watermark_position, watermark_opacity)
|
watermark_position, watermark_opacity, bind_to_ip_address)
|
||||||
|
|
||||||
|
|
||||||
def create_server_bob(path: str, domain: str, port: int,
|
def create_server_bob(path: str, domain: str, port: int,
|
||||||
|
@ -1087,6 +1088,7 @@ def create_server_bob(path: str, domain: str, port: int,
|
||||||
watermark_width_percent = 30
|
watermark_width_percent = 30
|
||||||
watermark_position = 'east'
|
watermark_position = 'east'
|
||||||
watermark_opacity = 10
|
watermark_opacity = 10
|
||||||
|
bind_to_ip_address = ''
|
||||||
print('Server running: Bob')
|
print('Server running: Bob')
|
||||||
run_daemon(accounts_data_dir,
|
run_daemon(accounts_data_dir,
|
||||||
no_of_books, public_replies_unlisted,
|
no_of_books, public_replies_unlisted,
|
||||||
|
@ -1119,7 +1121,7 @@ def create_server_bob(path: str, domain: str, port: int,
|
||||||
domain_max_posts_per_day, account_max_posts_per_day,
|
domain_max_posts_per_day, account_max_posts_per_day,
|
||||||
allow_deletion, True, True, False, send_threads,
|
allow_deletion, True, True, False, send_threads,
|
||||||
False, watermark_width_percent,
|
False, watermark_width_percent,
|
||||||
watermark_position, watermark_opacity)
|
watermark_position, watermark_opacity, bind_to_ip_address)
|
||||||
|
|
||||||
|
|
||||||
def create_server_eve(path: str, domain: str, port: int, federation_list: [],
|
def create_server_eve(path: str, domain: str, port: int, federation_list: [],
|
||||||
|
@ -1185,6 +1187,7 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
|
||||||
watermark_width_percent = 30
|
watermark_width_percent = 30
|
||||||
watermark_position = 'east'
|
watermark_position = 'east'
|
||||||
watermark_opacity = 10
|
watermark_opacity = 10
|
||||||
|
bind_to_ip_address = ''
|
||||||
print('Server running: Eve')
|
print('Server running: Eve')
|
||||||
run_daemon(accounts_data_dir, no_of_books,
|
run_daemon(accounts_data_dir, no_of_books,
|
||||||
public_replies_unlisted,
|
public_replies_unlisted,
|
||||||
|
@ -1239,7 +1242,7 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
|
||||||
send_threads, False,
|
send_threads, False,
|
||||||
watermark_width_percent,
|
watermark_width_percent,
|
||||||
watermark_position,
|
watermark_position,
|
||||||
watermark_opacity)
|
watermark_opacity, bind_to_ip_address)
|
||||||
|
|
||||||
|
|
||||||
def create_server_group(path: str, domain: str, port: int,
|
def create_server_group(path: str, domain: str, port: int,
|
||||||
|
@ -1307,6 +1310,7 @@ def create_server_group(path: str, domain: str, port: int,
|
||||||
watermark_width_percent = 30
|
watermark_width_percent = 30
|
||||||
watermark_position = 'east'
|
watermark_position = 'east'
|
||||||
watermark_opacity = 10
|
watermark_opacity = 10
|
||||||
|
bind_to_ip_address = ''
|
||||||
print('Server running: Group')
|
print('Server running: Group')
|
||||||
run_daemon(accounts_data_dir,
|
run_daemon(accounts_data_dir,
|
||||||
no_of_books, public_replies_unlisted,
|
no_of_books, public_replies_unlisted,
|
||||||
|
@ -1339,7 +1343,7 @@ def create_server_group(path: str, domain: str, port: int,
|
||||||
domain_max_posts_per_day, account_max_posts_per_day,
|
domain_max_posts_per_day, account_max_posts_per_day,
|
||||||
allow_deletion, True, True, False, send_threads,
|
allow_deletion, True, True, False, send_threads,
|
||||||
False, watermark_width_percent,
|
False, watermark_width_percent,
|
||||||
watermark_position, watermark_opacity)
|
watermark_position, watermark_opacity, bind_to_ip_address)
|
||||||
|
|
||||||
|
|
||||||
def test_post_message_between_servers(base_dir: str) -> None:
|
def test_post_message_between_servers(base_dir: str) -> None:
|
||||||
|
|
Loading…
Reference in New Issue