karkas/src/modules/standard/config/config.py
2024-04-25 15:57:06 +03:00

33 lines
707 B
Python

import yaml
from ....service import paths
def get_config(is_test: bool = False) -> dict:
if is_test:
path = f"{paths.modules_standard}/config/tests"
else:
path = paths.core
path = f"{path}/config.yaml"
with open(path, 'r') as file:
return yaml.full_load(file)
config = get_config()
def get_telegram_token() -> str:
return config["TELEGRAM"]["TOKEN"]
def get_yandexgpt_token() -> str:
return config["YANDEX_GPT_TOKEN"]
def get_yandexgpt_catalog_id() -> str:
return config["YANDEX_GPT_CATALOG_ID"]
def get_yandexgpt_prompt() -> str:
return config["YANDEX_GPT_PROMPT"]
def get_access_rights() -> dict:
return get_config()["ACCESS_RIGHTS"]