Merge pull request #6 from case/patch-1
Support loading config via env var
This commit is contained in:
commit
7b49a2fde2
10
download.py
10
download.py
|
@ -12,9 +12,13 @@ from do_http_get import do_get
|
||||||
##############################################################################################################
|
##############################################################################################################
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config_file = open("config.json", "r")
|
if 'CZDS_CONFIG' in os.environ:
|
||||||
config = json.load(config_file)
|
config_data = os.environ['CZDS_CONFIG']
|
||||||
config_file.close()
|
config = json.loads(config_data)
|
||||||
|
else:
|
||||||
|
config_file = open("config.json", "r")
|
||||||
|
config = json.load(config_file)
|
||||||
|
config_file.close()
|
||||||
except:
|
except:
|
||||||
sys.stderr.write("Error loading config.json file.\n")
|
sys.stderr.write("Error loading config.json file.\n")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
Loading…
Reference in a new issue