Files
rail-game/backend/app/core/config.py
zwitschi fc1e874309
Some checks failed
Backend CI / lint-and-test (push) Failing after 2m15s
Frontend CI / lint-and-build (push) Successful in 1m1s
feat: Initialize frontend and backend structure with essential configurations
- Added TypeScript build info for frontend.
- Created Vite configuration for React application.
- Implemented pre-commit hook to run checks before commits.
- Set up PostgreSQL Dockerfile with PostGIS support and initialization scripts.
- Added database creation script for PostgreSQL with necessary extensions.
- Established Python project configuration with dependencies and development tools.
- Developed pre-commit script to enforce code quality checks for backend and frontend.
- Created PowerShell script to set up Git hooks path.
2025-10-11 15:25:32 +02:00

39 lines
1.0 KiB
Python

from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import Optional
class Settings(BaseSettings):
project_name: str = "Rail Game API"
version: str = "0.1.0"
api_prefix: str = "/api"
jwt_secret_key: str = "insecure-change-me"
jwt_algorithm: str = "HS256"
access_token_expire_minutes: int = 60
database_url: str = "postgresql+psycopg://railgame:railgame@localhost:5432/railgame"
database_echo: bool = False
test_database_url: Optional[str] = None
alembic_database_url: Optional[str] = None
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
@property
def sqlalchemy_database_url(self) -> str:
return self.database_url
@property
def sqlalchemy_test_url(self) -> Optional[str]:
return self.test_database_url
@property
def sqlalchemy_alembic_url(self) -> str:
return self.alembic_database_url or self.database_url
@lru_cache()
def get_settings() -> Settings:
return Settings()