Make onionr use dirs from env
This commit is contained in:
parent
66d7dae08f
commit
9bd5efce1f
@ -5,7 +5,7 @@ set -e
|
|||||||
[ "root" != "$USER" ] && exec sudo $0 "$@"
|
[ "root" != "$USER" ] && exec sudo $0 "$@"
|
||||||
|
|
||||||
export OUTPUT_DIR=${OUTPUT_DIR:=/usr/share/onionr}
|
export OUTPUT_DIR=${OUTPUT_DIR:=/usr/share/onionr}
|
||||||
export DATA_DIR=${DATA_DIR:=/etc/onionr}
|
export ONIONR_HOME=${ONIONR_HOME:=/etc/onionr}
|
||||||
export LOG_DIR=${LOG_DIR:=/var/log/onionr}
|
export LOG_DIR=${LOG_DIR:=/var/log/onionr}
|
||||||
|
|
||||||
cd "$OUTPUT_DIR"
|
cd "$OUTPUT_DIR"
|
||||||
|
@ -64,10 +64,9 @@ class colors:
|
|||||||
'''
|
'''
|
||||||
Use the bitwise operators to merge these settings
|
Use the bitwise operators to merge these settings
|
||||||
'''
|
'''
|
||||||
|
USE_ANSI = 0b100
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
USE_ANSI = 0b000
|
USE_ANSI = 0b000
|
||||||
else:
|
|
||||||
USE_ANSI = 0b100
|
|
||||||
OUTPUT_TO_CONSOLE = 0b010
|
OUTPUT_TO_CONSOLE = 0b010
|
||||||
OUTPUT_TO_FILE = 0b001
|
OUTPUT_TO_FILE = 0b001
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ LEVEL_IMPORTANT = 6
|
|||||||
|
|
||||||
_type = OUTPUT_TO_CONSOLE | USE_ANSI # the default settings for logging
|
_type = OUTPUT_TO_CONSOLE | USE_ANSI # the default settings for logging
|
||||||
_level = LEVEL_DEBUG # the lowest level to log
|
_level = LEVEL_DEBUG # the lowest level to log
|
||||||
_outputfile = './output.log' # the file to log to
|
_outputfile = 'data/onionr.log' # the file to log to
|
||||||
|
|
||||||
def set_settings(type):
|
def set_settings(type):
|
||||||
'''
|
'''
|
||||||
|
@ -62,12 +62,13 @@ class Onionr:
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
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/'
|
# set log file
|
||||||
|
logger.set_file(os.environ.get('LOG_DIR', 'data') + '/onionr.log')
|
||||||
|
|
||||||
# Load global configuration data
|
# Load global configuration data
|
||||||
data_exists = Onionr.setupConfig(self.dataDir, self = self)
|
data_exists = Onionr.setupConfig(self.dataDir, self = self)
|
||||||
|
Loading…
Reference in New Issue
Block a user