summaryrefslogtreecommitdiff
path: root/iot_barcode_scanner/config.py
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-09-27 21:12:51 +0200
committerxengineering <mail2xengineering@protonmail.com>2020-09-27 21:12:51 +0200
commit449b490f233371fe28e9089a05982cd5634285d2 (patch)
tree64ccdf7879f0312f477cd381b5f10bd01b9dafbb /iot_barcode_scanner/config.py
parent30551b56cb20d6cd8dbf72277dc829e0041722ed (diff)
downloadiot-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.py23
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