28 lines
745 B
Python
28 lines
745 B
Python
|
|
"""Service configuration.
|
||
|
|
|
||
|
|
Every value is settable from the environment so the container needs no config
|
||
|
|
file. `database_url` has no default on purpose: a service that silently falls
|
||
|
|
back to a local database when its real one is misconfigured is worse than one
|
||
|
|
that refuses to start.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||
|
|
|
||
|
|
|
||
|
|
class Settings(BaseSettings):
|
||
|
|
model_config = SettingsConfigDict(env_prefix="CANNED_PROMPTS_", extra="ignore")
|
||
|
|
|
||
|
|
database_url: str = ""
|
||
|
|
tenant: str = "default"
|
||
|
|
service_name: str = "canned-prompts"
|
||
|
|
|
||
|
|
@property
|
||
|
|
def configured(self) -> bool:
|
||
|
|
return bool(self.database_url)
|
||
|
|
|
||
|
|
|
||
|
|
def get_settings() -> Settings:
|
||
|
|
return Settings()
|