PortProton_2.0/modules/config_parser.py
2025-03-11 19:48:44 +03:00

15 lines
452 B
Python

import json
from .logger import *
from .env_var import *
def var(var_name):
py_work_path = get_env_var("PYTHON_WORK_PATH")
# Читаем конфигурационный файл
try:
with open(py_work_path + "/config.json", "r") as file:
config = json.load(file)
return config[var_name]
except Exception as e:
log.critical(f"в config.json нет значения переменной: {e}")