Files
geozoner-back/app/config.py
Redsandy 3ea4fb4771 init
2026-03-14 18:48:57 +03:00

39 lines
1.2 KiB
Python

import os
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
# --- Database ---
# SQLite for local development, PostgreSQL for production
# Set DATABASE_URL in .env to override
DATABASE_URL: str = os.getenv(
"DATABASE_URL",
"sqlite:///geozoner.db",
)
# --- Auth / JWT ---
SECRET_KEY: str = os.getenv("SECRET_KEY", "change-me-in-production")
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "15"))
REFRESH_TOKEN_EXPIRE_DAYS: int = int(os.getenv("REFRESH_TOKEN_EXPIRE_DAYS", "7"))
# --- FCM (Firebase Cloud Messaging) ---
FCM_CREDENTIALS_PATH: str | None = os.getenv("FCM_CREDENTIALS_PATH")
# --- App ---
APP_HOST: str = os.getenv("APP_HOST", "0.0.0.0")
APP_PORT: int = int(os.getenv("APP_PORT", "8000"))
DEBUG: bool = os.getenv("DEBUG", "true").lower() in ("true", "1", "yes")
# --- CORS ---
CORS_ORIGINS: list[str] = os.getenv(
"CORS_ORIGINS",
"http://localhost,http://localhost:8000,http://127.0.0.1",
).split(",")
# --- Geo settings ---
MIN_ZONE_AREA_M2: float = float(os.getenv("MIN_ZONE_AREA_M2", "5000"))
LOOP_CLOSURE_RADIUS_M: float = float(os.getenv("LOOP_CLOSURE_RADIUS_M", "50"))
DOUGLAS_PEUCKER_EPSILON_M: float = float(os.getenv("DOUGLAS_PEUCKER_EPSILON_M", "5"))