Files
NexaPantry/backend/app/core/config.py
nessi 3792ca55e7
Some checks failed
CI / backend (push) Failing after 31s
CI / frontend (push) Successful in 40s
CI / docker (push) Has been skipped
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
2026-06-04 10:26:38 +02:00

35 lines
1.1 KiB
Python

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()