diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-09-27 21:12:51 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-09-27 21:12:51 +0200 |
commit | 449b490f233371fe28e9089a05982cd5634285d2 (patch) | |
tree | 64ccdf7879f0312f477cd381b5f10bd01b9dafbb /iot_barcode_scanner/config.py | |
parent | 30551b56cb20d6cd8dbf72277dc829e0041722ed (diff) | |
download | iot-barcode-scanner-449b490f233371fe28e9089a05982cd5634285d2.tar iot-barcode-scanner-449b490f233371fe28e9089a05982cd5634285d2.tar.zst iot-barcode-scanner-449b490f233371fe28e9089a05982cd5634285d2.zip |
Implement MVP
Diffstat (limited to 'iot_barcode_scanner/config.py')
-rw-r--r-- | iot_barcode_scanner/config.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/iot_barcode_scanner/config.py b/iot_barcode_scanner/config.py new file mode 100644 index 0000000..6b83393 --- /dev/null +++ b/iot_barcode_scanner/config.py @@ -0,0 +1,23 @@ + + +"""Module to read the Configuration File for the Service""" + + +import sys +import json +from iot_barcode_scanner.static import CONFIG_PATH + + +def get_config(): + """Read Config File and return it as Python Object""" + + try: + with open(CONFIG_PATH, "r") as config_file: + text = config_file.read() + except FileNotFoundError: + print("Config file does not exist.") + sys.exit(1) + + data = json.loads(text) + + return data |