playreel/backend/settings.py
2026-09-15 16:00:54 +09:00

38 lines
1.2 KiB
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 = ""
# 비어 있으면 구글 로그인이 꺼진다. 값은 비밀이 아니라 프론트 번들에도 들어간다
google_client_id: str = ""
# 자체 세션 토큰 서명 키. 바뀌면 로그인된 사람이 전부 풀린다
jwt_secret: str = ""
jwt_days: int = 14
@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()