-
Notifications
You must be signed in to change notification settings - Fork 2
/
load_config.py
29 lines (25 loc) · 915 Bytes
/
load_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import json
### Load Config
# Get the directory where the script is located to build the path for the config file
script_dir = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(script_dir, 'config.json')
# Load configuration from the config.py file
config = {}
if os.path.exists(config_path):
with open(config_path, 'r') as config_file:
config = json.load(config_file)
else:
raise FileNotFoundError(f"Configuration file not found: {config_path}")
# Extract necessary config values
BROKER = config['broker']['address']
PORT = config['broker']['port']
USER = config['broker']['user']
PASSWORD = config['broker']['password']
TOPICS = config['topics']
KEY = config['key']
FORWARDED_PORTNUMS = config['forwarded_portnums']
HOP_MODIFIER = config['hop_modifier']
NICKS = config['nicks']
# Get the full default key
KEY = "1PG7OiApB1nwvP+rz05pAQ==" if KEY == "AQ==" else KEY