Use ONIONR_HOME or DATA_DIR env vars
This commit is contained in:
parent
9bd5efce1f
commit
8bae211a8d
@ -20,13 +20,11 @@
|
|||||||
|
|
||||||
import os, json, logger
|
import os, json, logger
|
||||||
|
|
||||||
try:
|
# set data dir
|
||||||
dataDir = os.environ['ONIONR_HOME']
|
dataDir = os.environ.get('ONIONR_HOME', os.environ.get('DATA_DIR', 'data/'))
|
||||||
if not dataDir.endswith('/'):
|
if not dataDir.endswith('/'):
|
||||||
dataDir += '/'
|
dataDir += '/'
|
||||||
except KeyError:
|
|
||||||
dataDir = 'data/'
|
|
||||||
|
|
||||||
_configfile = os.path.abspath(dataDir + 'config.json')
|
_configfile = os.path.abspath(dataDir + 'config.json')
|
||||||
_config = {}
|
_config = {}
|
||||||
|
|
||||||
|
@ -39,12 +39,10 @@ class Core:
|
|||||||
Initialize Core Onionr library
|
Initialize Core Onionr library
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
# set data dir
|
||||||
self.dataDir = os.environ['ONIONR_HOME']
|
self.dataDir = os.environ.get('ONIONR_HOME', os.environ.get('DATA_DIR', 'data/'))
|
||||||
if not self.dataDir.endswith('/'):
|
if not self.dataDir.endswith('/'):
|
||||||
self.dataDir += '/'
|
self.dataDir += '/'
|
||||||
except KeyError:
|
|
||||||
self.dataDir = 'data/'
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.onionrInst = None
|
self.onionrInst = None
|
||||||
|
@ -46,12 +46,10 @@ class NetController:
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, hsPort, apiServerIP='127.0.0.1'):
|
def __init__(self, hsPort, apiServerIP='127.0.0.1'):
|
||||||
try:
|
# set data dir
|
||||||
self.dataDir = os.environ['ONIONR_HOME']
|
self.dataDir = os.environ.get('ONIONR_HOME', os.environ.get('DATA_DIR', 'data/'))
|
||||||
if not self.dataDir.endswith('/'):
|
if not self.dataDir.endswith('/'):
|
||||||
self.dataDir += '/'
|
self.dataDir += '/'
|
||||||
except KeyError:
|
|
||||||
self.dataDir = 'data/'
|
|
||||||
|
|
||||||
self.torConfigLocation = self.dataDir + 'torrc'
|
self.torConfigLocation = self.dataDir + 'torrc'
|
||||||
self.readyState = False
|
self.readyState = False
|
||||||
@ -165,7 +163,7 @@ HiddenServicePort 80 ''' + self.apiServerIP + ''':''' + str(self.hsPort)
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logger.fatal('Got keyboard interrupt.', timestamp = False, level = logger.LEVEL_IMPORTANT)
|
logger.fatal('Got keyboard interrupt.', timestamp = False, level = logger.LEVEL_IMPORTANT)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.debug('Finished starting Tor.', timestamp=True)
|
logger.debug('Finished starting Tor.', timestamp=True)
|
||||||
self.readyState = True
|
self.readyState = True
|
||||||
|
|
||||||
|
@ -21,12 +21,10 @@
|
|||||||
import os, re, importlib, config, logger
|
import os, re, importlib, config, logger
|
||||||
import onionrevents as events
|
import onionrevents as events
|
||||||
|
|
||||||
try:
|
# set data dir
|
||||||
dataDir = os.environ['ONIONR_HOME']
|
dataDir = os.environ.get('ONIONR_HOME', os.environ.get('DATA_DIR', 'data/'))
|
||||||
if not dataDir.endswith('/'):
|
if not dataDir.endswith('/'):
|
||||||
dataDir += '/'
|
dataDir += '/'
|
||||||
except KeyError:
|
|
||||||
dataDir = 'data/'
|
|
||||||
|
|
||||||
_pluginsfolder = dataDir + 'plugins/'
|
_pluginsfolder = dataDir + 'plugins/'
|
||||||
_instances = dict()
|
_instances = dict()
|
||||||
|
Loading…
Reference in New Issue
Block a user