40 lines
919 B
Python
40 lines
919 B
Python
"""Task config."""
|
|
|
|
from enum import Enum
|
|
from typing import Optional
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Environment(Enum):
|
|
"""JARVIS running environment."""
|
|
|
|
production = "production"
|
|
develop = "develop"
|
|
|
|
|
|
class Mongo(BaseSettings):
|
|
"""MongoDB config."""
|
|
|
|
host: list[str] | str = "localhost"
|
|
username: Optional[str] = None
|
|
password: Optional[str] = None
|
|
port: int = 27017
|
|
|
|
|
|
class Config(BaseSettings, case_sensitive=False):
|
|
"""Tasks config model."""
|
|
|
|
token: str
|
|
mongo: Mongo = Mongo()
|
|
log_level: str = "INFO"
|
|
environment: Environment = Environment.develop
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env", env_file_encoding="utf-8", env_nested_delimiter="."
|
|
)
|
|
|
|
|
|
def load_config() -> Config:
|
|
"""Load the config using the specified method first"""
|
|
return Config()
|