04689a29bd
Garmin Connect sync: - Incremental syncs now re-fetch only a 1-day buffer (yesterday + today) instead of the full lookback window every run. Full lookback applies on the first sync only. Cuts steady-state API calls ~10x. - Beat interval is now configurable via GARMIN_SYNC_INTERVAL_MINUTES and surfaced to the UI; the sync toggle is relabelled to the real cadence. Frontend: - Collapsible sidebar; clearer logged-in user + role display. - Unified Body Battery colouring between dashboard and health (shared util). - Sleep score trend chart on health page. - Segments + medals on the dashboard's most-recent activity. - Segments tab on the Records page. Repo hygiene: add .gitignore, untrack committed __pycache__/*.pyc. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
from pydantic_settings import BaseSettings
|
|
from pydantic import Field
|
|
from typing import Optional
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# Database
|
|
database_url: str = Field(..., env="DATABASE_URL")
|
|
# Redis
|
|
redis_url: str = Field("redis://localhost:6379/0", env="REDIS_URL")
|
|
# Auth
|
|
secret_key: str = Field(..., env="SECRET_KEY")
|
|
algorithm: str = "HS256"
|
|
access_token_expire_minutes: int = 60 * 24 * 7 # 7 days
|
|
# Admin account
|
|
admin_username: str = Field("admin", env="ADMIN_USERNAME")
|
|
admin_password: Optional[str] = Field(None, env="ADMIN_PASSWORD")
|
|
# Base URL - used for OAuth callbacks
|
|
base_url: str = Field("https://milevault.jarrett.eu", env="BASE_URL")
|
|
# PocketID OIDC (optional)
|
|
pocketid_issuer: Optional[str] = Field(None, env="POCKETID_ISSUER")
|
|
pocketid_client_id: Optional[str] = Field(None, env="POCKETID_CLIENT_ID")
|
|
pocketid_client_secret: Optional[str] = Field(None, env="POCKETID_CLIENT_SECRET")
|
|
pocketid_allowed_group: Optional[str] = Field(None, env="POCKETID_ALLOWED_GROUP")
|
|
# Garmin Connect — how often the beat scheduler runs the automatic sync
|
|
garmin_sync_interval_minutes: int = Field(30, env="GARMIN_SYNC_INTERVAL_MINUTES")
|
|
# Files
|
|
file_store_path: str = Field("/data/files", env="FILE_STORE_PATH")
|
|
# Environment
|
|
environment: str = Field("production", env="ENVIRONMENT")
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
|
|
|
|
settings = Settings() |