Skip to content

Commit d7da11c

Browse files
committed
update: more environment variables
1 parent 2f3de4a commit d7da11c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

boot.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def fetchOpt(args: list, option: str, default):
4747
saltValue = fetchOpt(sys.argv, '--salt', saltValue)
4848

4949

50+
isolateRoom = False # disable isolate room in default
51+
if 'ISOLATE' in os.environ and os.environ['ISOLATE'] in ['ON', 'TRUE']:
52+
isolateRoom = True
53+
if checkOpt(sys.argv, '--isolate-room'):
54+
isolateRoom = True
55+
56+
5057
tlsPath = '/certs'
5158
if 'TLS_PATH' in os.environ: # `TLS_PATH` env variable
5259
tlsPath = os.environ['TLS_PATH']
@@ -59,7 +66,11 @@ def fetchOpt(args: list, option: str, default):
5966
enableTls = True
6067

6168

62-
motdMessage = fetchOpt(sys.argv, '--motd', None) # without motd message in default
69+
motdMessage = None # without motd message in default
70+
if 'MOTD' in os.environ: # `MOTD` env variable
71+
motdMessage = os.environ['MOTD']
72+
motdMessage = fetchOpt(sys.argv, '--motd', motdMessage)
73+
6374
motdFile = fetchOpt(sys.argv, '--motd-file', None)
6475
if motdFile is not None:
6576
motdMessage = None # cover motd message
@@ -72,13 +83,16 @@ def fetchOpt(args: list, option: str, default):
7283

7384
if isDebug: # print debug log
7485
if portValue is not None:
75-
print('Port -> %s' % portValue)
86+
print('Port -> %s' % portValue, file = sys.stderr)
7687

7788
if saltValue is None:
7889
print('Using random salt', file = sys.stderr)
7990
else:
8091
print('Salt -> `%s`' % saltValue, file = sys.stderr)
8192

93+
if isolateRoom:
94+
print('Isolate room enabled', file = sys.stderr)
95+
8296
if passwdStr is None:
8397
print('Running without password', file = sys.stderr)
8498
else:
@@ -101,6 +115,8 @@ def fetchOpt(args: list, option: str, default):
101115
sys.argv += ['--salt', saltValue]
102116
if enableTls:
103117
sys.argv += ['--tls', tlsPath]
118+
if isolateRoom:
119+
sys.argv += ['--isolate-room']
104120
if motdFile is not None:
105121
sys.argv += ['--motd-file', motdFile]
106122

0 commit comments

Comments
 (0)