Automated Action fec0fa72e7 Initial project setup with FastAPI, SQLite, and Alembic
- Set up SQLite database configuration and directory structure
- Configure Alembic for proper SQLite migrations
- Add initial model schemas and API endpoints
- Fix OAuth2 authentication
- Implement proper code formatting with Ruff
2025-05-27 20:34:02 +00:00

44 lines
1.0 KiB
Python

from pathlib import Path
from typing import List
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Application settings."""
# Project info
PROJECT_NAME: str = "Weather Dashboard API"
PROJECT_DESCRIPTION: str = "API for weather data, forecasts, and more"
VERSION: str = "0.1.0"
# API
API_V1_STR: str = "/api/v1"
# CORS
CORS_ORIGINS: List[str] = ["*"]
# OpenWeather API
OPENWEATHER_API_KEY: str = ""
OPENWEATHER_API_URL: str = "https://api.openweathermap.org/data/2.5"
# JWT
SECRET_KEY: str = "REPLACE_THIS_WITH_A_SECURE_SECRET_KEY"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
# Cache
CACHE_EXPIRATION_SECONDS: int = 300 # 5 minutes
class Config:
env_file = ".env"
case_sensitive = True
# Create settings instance
settings = Settings()
# Database paths
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"