Skip to content

Commit

Permalink
#13: Exit on missing config values
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Jul 29, 2019
1 parent ff81709 commit eec6821
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions common/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import sys


class Config(object):
Expand All @@ -9,13 +10,22 @@ def __init__(self):
target.close()

def get_db_url(self):
return self.config["DB_URL"]
try:
return self.config["DB_URL"]
except:
sys.exit("Missing config value, DB_URL")

def get_log_level(self):
return self.config["log_level"]
try:
return self.config["log_level"]
except:
sys.exit("Missing config value, log_level")

def is_debug_mode(self):
return self.config["debug_mode"]
try:
return self.config["debug_mode"]
except:
sys.exit("Missing config value, debug_mode")


config = Config()

0 comments on commit eec6821

Please sign in to comment.