
- Set up project structure with FastAPI - Implement user authentication system with JWT tokens - Create database models for users, notes, and collections - Set up SQLAlchemy ORM and Alembic migrations - Implement CRUD operations for notes and collections - Add filtering and sorting capabilities for notes - Implement health check endpoint - Update project documentation
28 lines
659 B
Python
28 lines
659 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
PROJECT_NAME: str = "Notes API"
|
|
API_V1_STR: str = "/api/v1"
|
|
|
|
# Security
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "please_change_this_to_a_random_secret_key")
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
|
|
|
|
# Database
|
|
DB_DIR = Path("/app/storage/db")
|
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
# CORS
|
|
CORS_ORIGINS: list[str] = ["*"]
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
settings = Settings()
|