chore: initial project setup with backend, frontend, and infrastructure
Add complete NexaPantry application structure including: - Docker Compose configuration with PostgreSQL, Redis, FastAPI backend, worker, frontend and Caddy - Environment configuration template with database, auth, and service settings - GitHub Actions CI workflow for backend/frontend linting, testing, auditing and Docker builds - AGPL-3.0 license and comprehensive README with setup, development, and security documentation - Backend
This commit is contained in:
34
backend/app/core/config.py
Normal file
34
backend/app/core/config.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from functools import lru_cache
|
||||
|
||||
from pydantic import field_validator
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
app_env: str = "production"
|
||||
instance_url: str = "http://localhost"
|
||||
frontend_origin: str = "http://localhost"
|
||||
database_url: str = "postgresql+psycopg://nexapantry:nexapantry@localhost:5432/nexapantry"
|
||||
redis_url: str | None = None
|
||||
jwt_secret_key: str
|
||||
settings_secret_key: str
|
||||
cookie_secure: bool = True
|
||||
cors_origins: list[str] = ["http://localhost"]
|
||||
log_level: str = "INFO"
|
||||
default_timezone: str = "Europe/Vienna"
|
||||
daily_worker_interval_seconds: int = 300
|
||||
|
||||
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
||||
|
||||
@field_validator("cors_origins", mode="before")
|
||||
@classmethod
|
||||
def parse_origins(cls, value: str | list[str]) -> list[str]:
|
||||
if isinstance(value, str):
|
||||
return [origin.strip() for origin in value.split(",") if origin.strip()]
|
||||
return value
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
|
||||
Reference in New Issue
Block a user