init
This commit is contained in:
27
app/core/config.py
Normal file
27
app/core/config.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from functools import lru_cache
|
||||
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
||||
|
||||
database_url: str = "sqlite:///./vyryi.db"
|
||||
jwt_secret: str = "dev-secret-change-me"
|
||||
jwt_algorithm: str = "HS256"
|
||||
jwt_expire_minutes: int = 60 * 24 * 7
|
||||
cors_origins: str = (
|
||||
"http://localhost:5173,http://127.0.0.1:5173,"
|
||||
"http://localhost:5174,http://127.0.0.1:5174"
|
||||
)
|
||||
cors_origin_regex: str = r"http://(localhost|127\.0\.0\.1):\d+"
|
||||
bot_token: str = ""
|
||||
|
||||
@property
|
||||
def cors_origins_list(self) -> list[str]:
|
||||
return [origin.strip() for origin in self.cors_origins.split(",") if origin.strip()]
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
Reference in New Issue
Block a user