mirror of
https://github.com/artiemis/artemis.git
synced 2026-02-14 00:21:56 +00:00
44 lines
738 B
Python
44 lines
738 B
Python
import os
|
|
from dataclasses import dataclass
|
|
|
|
from .common import read_toml
|
|
|
|
|
|
@dataclass
|
|
class Secrets:
|
|
api: str
|
|
catbox: str
|
|
github: str
|
|
cloudflare: str
|
|
openai: str
|
|
deepl: str
|
|
huggingface: str
|
|
|
|
|
|
@dataclass
|
|
class Config:
|
|
token: str
|
|
prefix: str
|
|
user_agent: str
|
|
real_user_agent: str
|
|
internal_api_url: str
|
|
cdn_url: str
|
|
main_guild_id: int
|
|
dev_guild_id: int
|
|
secrets: Secrets
|
|
|
|
def __post_init__(self):
|
|
self.secrets = Secrets(**self.secrets)
|
|
|
|
|
|
def load_config() -> Config:
|
|
if os.getenv("ENV") == "production":
|
|
values = read_toml("config.prod.toml")
|
|
else:
|
|
values = read_toml("config.dev.toml")
|
|
|
|
return Config(**values)
|
|
|
|
|
|
config = load_config()
|