summaryrefslogtreecommitdiff
path: root/iot_barcode_scanner/config.py
blob: 6b83393fa253f869e171ac850ed5a3c0e084ff2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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