55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
from pydantic import Field
|
|
|
|
|
|
class DBSettings(BaseSettings):
|
|
DATABASE_URL: str
|
|
|
|
class MinioSettings(BaseSettings):
|
|
MINIO_URL: str
|
|
MINIO_ADMIN_LOGIN: str
|
|
MINIO_ADMIN_PASSWORD: str
|
|
MINIO_BUCKET: str
|
|
MINIO_SECURE: bool = True
|
|
|
|
class NATSSettings(BaseSettings):
|
|
NATS_URL: str
|
|
NATS_JWT: str = Field(min_length=1)
|
|
NATS_SEED: str = Field(min_length=1)
|
|
|
|
class SMBSettings(BaseSettings):
|
|
SMB_HOST: str
|
|
SMB_PORT: int = 445
|
|
SMB_PATH: str
|
|
SMB_LOGIN: str
|
|
SMB_PASSWORD: str
|
|
|
|
class OpenBAOSettings(BaseSettings):
|
|
DATABASE: DBSettings
|
|
MINIO: MinioSettings | None = None
|
|
NATS: NATSSettings | None = None
|
|
SMB: SMBSettings | None = None
|
|
|
|
class ServerSettings(BaseSettings):
|
|
HOST: str = "0.0.0.0"
|
|
PORT: int = 8000
|
|
|
|
class Settings(BaseSettings):
|
|
OPENBAO: OpenBAOSettings
|
|
DEBUG: bool = False
|
|
server: ServerSettings = ServerSettings()
|
|
ROOT_PATH: str = '/'
|
|
VERSION: str = '1.0.0'
|
|
|
|
class Config:
|
|
case_sensitive = True
|
|
extra = "ignore"
|
|
env_file = ".env"
|
|
env_nested_delimiter = "__"
|
|
nested_model_default_partial_update = False
|
|
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
settings = get_settings()
|