35 lines
860 B
Python
35 lines
860 B
Python
|
|
from enum import Enum
|
||
|
|
|
||
|
|
from pydantic_settings import BaseSettings
|
||
|
|
|
||
|
|
class AppEnvironment(str, Enum):
|
||
|
|
PRODUCTION = "prod"
|
||
|
|
DEVELOPMENT = "dev"
|
||
|
|
TESTING = "test"
|
||
|
|
|
||
|
|
class Config(BaseSettings):
|
||
|
|
|
||
|
|
API_V1_STR: str = "/api/v1"
|
||
|
|
|
||
|
|
APP_VERSION: str = "Unversioned API"
|
||
|
|
ENV: AppEnvironment = AppEnvironment.DEVELOPMENT
|
||
|
|
|
||
|
|
UVICORN_HOST: str = "0.0.0.0"
|
||
|
|
UVICORN_PORT: int = 8888
|
||
|
|
|
||
|
|
BACKEND_CORS_ORIGINS: str = ""
|
||
|
|
|
||
|
|
PROJECT_NAME: str = "freeleaps-authentication"
|
||
|
|
|
||
|
|
LOGGING_LEVEL: str = "INFO"
|
||
|
|
|
||
|
|
def is_development(self) -> bool:
|
||
|
|
return self.ENV == AppEnvironment.DEVELOPMENT
|
||
|
|
|
||
|
|
def is_testing(self) -> bool:
|
||
|
|
return self.ENV == AppEnvironment.TESTING
|
||
|
|
|
||
|
|
def is_production(self) -> bool:
|
||
|
|
return self.ENV == AppEnvironment.PRODUCTION
|
||
|
|
|
||
|
|
settings = Config(_env_file=".env", _env_file_encoding="utf-8")
|