Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from functools import lru_cache
|
||||
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
database_url: str = "postgresql+psycopg://train_watcher:train_watcher@localhost:5432/train_watcher"
|
||||
logic_base_url: str = "http://localhost:8002"
|
||||
service_token: str = "dev-service-token-change-me"
|
||||
jwt_secret: str = "dev-jwt-secret-change-me"
|
||||
jwt_algorithm: str = "HS256"
|
||||
access_token_ttl_minutes: int = 60 * 24
|
||||
|
||||
s3_endpoint_url: str = "http://localhost:9000"
|
||||
s3_public_base_url: str = "http://localhost:9000"
|
||||
s3_access_key_id: str = "minioadmin"
|
||||
s3_secret_access_key: str = "minioadmin"
|
||||
s3_bucket: str = "train-watcher-media"
|
||||
s3_region: str = "us-east-1"
|
||||
max_upload_bytes: int = 5 * 1024 * 1024
|
||||
|
||||
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
|
||||
|
||||
settings = get_settings()
|
||||
Reference in New Issue
Block a user