playreel/backend/settings.py

32 lines
986 B
Python

from urllib.parse import quote_plus
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
chatgpt_api_key: str
typecast_api_key: str = "" # typecast 엔진을 쓸 때만 필요
suno_api_key: str = ""
suno_callback_url: str = "" # Suno가 요구하는 값. 결과는 폴링으로 받는다
higgsfield_account: str = "" # CLI 토큰이 이 계정 것인지 확인만 한다
mysql_host: str = ""
mysql_port: int = 3306
mysql_user: str = ""
mysql_password: str = ""
mysql_db: str = ""
azure_blob_base_url: str = ""
azure_blob_sas_token: str = ""
@property
def mysql_url(self) -> str:
password = quote_plus(self.mysql_password)
return (f"mysql+asyncmy://{self.mysql_user}:{password}"
f"@{self.mysql_host}:{self.mysql_port}/{self.mysql_db}")
settings = Settings()