21 lines
560 B
Python
21 lines
560 B
Python
from pydantic_settings import BaseSettings
|
|
from typing import Literal, List
|
|
import os
|
|
|
|
class Settings(BaseSettings):
|
|
database_url: str
|
|
environment: Literal["dev", "stage", "prod"]
|
|
hashids_salt: str
|
|
encoder_alphabet: str
|
|
allow_origins: str
|
|
|
|
class Config:
|
|
env_file = os.path.join(os.path.dirname(__file__), ".env")
|
|
env_file_encoding = "utf-8"
|
|
|
|
def get_allow_origins(self) -> List[str]:
|
|
return [origin.strip() for origin in self.allow_origins.split(",")]
|
|
|
|
# Singleton instance of settings
|
|
settings = Settings()
|