Browse Source

update: more environment variables

pull/2/head
Dnomd343 2 years ago
parent
commit
d7da11c3e3
  1. 20
      boot.py

20
boot.py

@ -47,6 +47,13 @@ if checkOpt(sys.argv, '--random-salt'):
saltValue = fetchOpt(sys.argv, '--salt', saltValue) saltValue = fetchOpt(sys.argv, '--salt', saltValue)
isolateRoom = False # disable isolate room in default
if 'ISOLATE' in os.environ and os.environ['ISOLATE'] in ['ON', 'TRUE']:
isolateRoom = True
if checkOpt(sys.argv, '--isolate-room'):
isolateRoom = True
tlsPath = '/certs' tlsPath = '/certs'
if 'TLS_PATH' in os.environ: # `TLS_PATH` env variable if 'TLS_PATH' in os.environ: # `TLS_PATH` env variable
tlsPath = os.environ['TLS_PATH'] tlsPath = os.environ['TLS_PATH']
@ -59,7 +66,11 @@ if 'TLS' in os.environ and os.environ['TLS'] in ['ON', 'TRUE']:
enableTls = True enableTls = True
motdMessage = fetchOpt(sys.argv, '--motd', None) # without motd message in default motdMessage = None # without motd message in default
if 'MOTD' in os.environ: # `MOTD` env variable
motdMessage = os.environ['MOTD']
motdMessage = fetchOpt(sys.argv, '--motd', motdMessage)
motdFile = fetchOpt(sys.argv, '--motd-file', None) motdFile = fetchOpt(sys.argv, '--motd-file', None)
if motdFile is not None: if motdFile is not None:
motdMessage = None # cover motd message motdMessage = None # cover motd message
@ -72,13 +83,16 @@ elif motdMessage is not None:
if isDebug: # print debug log if isDebug: # print debug log
if portValue is not None: if portValue is not None:
print('Port -> %s' % portValue) print('Port -> %s' % portValue, file = sys.stderr)
if saltValue is None: if saltValue is None:
print('Using random salt', file = sys.stderr) print('Using random salt', file = sys.stderr)
else: else:
print('Salt -> `%s`' % saltValue, file = sys.stderr) print('Salt -> `%s`' % saltValue, file = sys.stderr)
if isolateRoom:
print('Isolate room enabled', file = sys.stderr)
if passwdStr is None: if passwdStr is None:
print('Running without password', file = sys.stderr) print('Running without password', file = sys.stderr)
else: else:
@ -101,6 +115,8 @@ if saltValue is not None:
sys.argv += ['--salt', saltValue] sys.argv += ['--salt', saltValue]
if enableTls: if enableTls:
sys.argv += ['--tls', tlsPath] sys.argv += ['--tls', tlsPath]
if isolateRoom:
sys.argv += ['--isolate-room']
if motdFile is not None: if motdFile is not None:
sys.argv += ['--motd-file', motdFile] sys.argv += ['--motd-file', motdFile]

Loading…
Cancel
Save