@@ -23,19 +23,21 @@ def __build_parser(self) -> Generator:
2323 """ Build arguments parser for Syncplay bootstrap. """
2424 parser = argparse .ArgumentParser (description = 'Syncplay Docker Bootstrap' )
2525 yield parser .add_argument ('-p' , '--port' , type = int , help = 'listen port of syncplay server' )
26- yield parser .add_argument ('--password' , type = str , help = 'authentication of syncplay server' )
27- yield parser .add_argument ('--motd' , type = str , help = 'welcome text after the user enters the room' )
28- yield parser .add_argument ('--salt' , type = str , help = 'string used to secure passwords' )
26+ yield parser .add_argument ('--password' , metavar = 'PASSWD' , type = str , help = 'authentication of syncplay server' )
27+ yield parser .add_argument ('--motd' , metavar = 'MESSAGE' , type = str , help = 'welcome text after the user enters the room' )
28+ yield parser .add_argument ('--salt' , metavar = 'TEXT' , type = str , help = 'string used to secure passwords' )
2929 yield parser .add_argument ('--random-salt' , action = 'store_true' , help = 'use a randomly generated salt value' )
3030 yield parser .add_argument ('--isolate-rooms' , action = 'store_true' , help = 'room isolation enabled' )
3131 yield parser .add_argument ('--disable-chat' , action = 'store_true' , help = 'disables the chat feature' )
3232 yield parser .add_argument ('--disable-ready' , action = 'store_true' , help = 'disables the readiness indicator feature' )
3333 yield parser .add_argument ('--enable-stats' , action = 'store_true' , help = 'enable syncplay server statistics' )
3434 yield parser .add_argument ('--enable-tls' , action = 'store_true' , help = 'enable tls support of syncplay server' )
3535 yield parser .add_argument ('--persistent' , action = 'store_true' , help = 'enables room persistence' )
36- yield parser .add_argument ('--max-username' , type = int , help = 'maximum length of usernames' )
37- yield parser .add_argument ('--max-chat-message' , type = int , help = 'maximum length of chat messages' )
38- yield parser .add_argument ('--permanent-rooms' , type = str , nargs = '*' , help = 'permanent rooms of syncplay server' )
36+ yield parser .add_argument ('--max-username' , metavar = 'NUM' , type = int , help = 'maximum length of usernames' )
37+ yield parser .add_argument ('--max-chat-message' , metavar = 'NUM' , type = int , help = 'maximum length of chat messages' )
38+ yield parser .add_argument ('--permanent-rooms' , metavar = 'ROOM' , type = str , nargs = '*' , help = 'permanent rooms of syncplay server' )
39+ yield parser .add_argument ('--listen-ipv4' , metavar = 'INTERFACE' , type = str , help = 'listening address of ipv4' )
40+ yield parser .add_argument ('--listen-ipv6' , metavar = 'INTERFACE' , type = str , help = 'listening address of ipv6' )
3941 self .__parser = parser
4042
4143 def __build_options (self ) -> Generator :
@@ -61,7 +63,7 @@ def __init__(self, args: list[str], config: dict[str, Any],
6163 self .__debug (f'Command line options -> { cli_opts } \n ' )
6264
6365 self .__opts = env_opts | cfg_opts | cli_opts
64- self .__debug (f'Bootstrap final options -> { self .__opts } ' )
66+ self .__debug (f'Bootstrap final options -> { self .__opts } \n ' )
6567
6668 def __load_from_args (self , raw_args : list [str ]) -> dict [str , Any ]:
6769 """ Loading options from command line arguments. """
@@ -111,7 +113,7 @@ def release(self) -> list[str]:
111113 args += ['--salt' , salt ] # using random salt without this option
112114 for opt in ['isolate_rooms' , 'disable_chat' , 'disable_ready' ]:
113115 if opt in self .__opts :
114- args .append (f'--{ opt .replace ("_" , "-" ) } ' )
116+ args .append (f'--{ opt } ' .replace ('_' , '-' ) )
115117
116118 if 'enable_stats' in self .__opts :
117119 args += ['--stats-db-file' , os .path .join (self .__work_dir , 'stats.db' )]
@@ -128,6 +130,14 @@ def release(self) -> list[str]:
128130 rooms = '\n ' .join (self .__opts ['permanent_rooms' ])
129131 args += ['--permanent-rooms-file' , SyncplayBoot .__temp_file ('rooms.list' , rooms )]
130132
133+ if 'listen_ipv4' in self .__opts and 'listen_ipv6' in self .__opts :
134+ args += ['--interface-ipv4' , self .__opts ['listen_ipv4' ]]
135+ args += ['--interface-ipv6' , self .__opts ['listen_ipv6' ]]
136+ elif 'listen_ipv4' in self .__opts :
137+ args += ['--ipv4-only' , '--interface-ipv4' , self .__opts ['listen_ipv4' ]]
138+ elif 'listen_ipv6' in self .__opts :
139+ args += ['--ipv6-only' , '--interface-ipv6' , self .__opts ['listen_ipv6' ]]
140+
131141 self .__debug (f'Syncplay startup arguments -> { args } ' )
132142 return args
133143
0 commit comments