summaryrefslogtreecommitdiff
path: root/iot_barcode/config.py
blob: 7435f8b741fb5eb0d467f3b358dcdc3e84de0ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24


"""Module to read the Configuration File for the Service"""


import sys
import json

from iot_barcode.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