22 lines
592 B
Python
22 lines
592 B
Python
import secrets
|
|
from pathlib import Path
|
|
from pydantic import BaseSettings
|
|
|
|
class Settings(BaseSettings):
|
|
PROJECT_NAME: str = "REST API Service"
|
|
API_V1_STR: str = "/api/v1"
|
|
VERSION: str = "0.1.0"
|
|
SECRET_KEY: str = secrets.token_urlsafe(32)
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8 # 8 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"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
settings = Settings()
|