Browse Source

Add ALLOW_ROOT option

master
Luke Childs 7 years ago
parent
commit
df9d8e2d8e
  1. 10
      server/controller.py
  2. 1
      server/env.py

10
server/controller.py

@ -51,9 +51,13 @@ class Controller(util.LoggedClass):
if sys.version_info < (3, 5, 3):
raise RuntimeError('Python >= 3.5.3 is required to run ElectrumX')
if os.geteuid() == 0:
raise RuntimeError('DO NOT RUN AS ROOT! Create an unprivileged '
'user account and use that')
if os.geteuid() == 0 and not env.allow_root:
raise RuntimeError('RUNNING AS ROOT IS STRONGLY DISCOURAGED!\n'
'You shoud create an unprivileged user account '
'and use that.\n'
'\n'
'If you\'d like to continue as root, please run '
'this again with ALLOW_ROOT=1')
# Set the event loop policy before doing anything asyncio
self.logger.info('event loop policy: {}'.format(env.loop_policy))

1
server/env.py

@ -29,6 +29,7 @@ class Env(lib_util.LoggedClass):
def __init__(self):
super().__init__()
self.obsolete(['UTXO_MB', 'HIST_MB', 'NETWORK'])
self.allow_root = self.boolean('ALLOW_ROOT', False)
self.db_dir = self.required('DB_DIRECTORY')
self.daemon_url = self.required('DAEMON_URL')
coin_name = self.required('COIN').strip()

Loading…
Cancel
Save