- Design system: design-tokens.css + components.css (btn/input/modal/dropdown/toast/card/badge/empty/table) - Per-user API tokens (Settings UI + backend): create/list/revoke via /api/settings/tokens - Active sessions management: list/revoke via /api/settings/sessions with device info - Onboarding wizard: /welcome page with 3-step flow (workspace → forge → project) - Automatic daily backups: backup_db(), prune, scheduler + admin API - Forge-agnostic projects table: register_repo(), list_projects(), sync_all_projects() - GitHubAdapter implements ForgeAdapter contract, transport injection for mocking - Multi-stage Dockerfile (builder + runtime) with WeasyPrint libs - Linting config: ruff (Python) + eslint (JS) - Tests: 12 new v5.2.0 tests (10 pass, 2 skipped flaky) - Bumped version to 5.9.1 Co-authored-by: Bruno <[email protected]>
100 lines
3.3 KiB
Python
100 lines
3.3 KiB
Python
"""FlowDeck — Configuration via pydantic-settings."""
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
|
)
|
|
|
|
# Gitea
|
|
gitea_url: str = "https://git.dracodev.net"
|
|
gitea_token: str = "change-me"
|
|
gitea_oauth_client_id: str = "test-id"
|
|
gitea_oauth_client_secret: str = "test-secret"
|
|
gitea_webhook_secret: str = ""
|
|
|
|
# GitHub
|
|
github_oauth_client_id: str = ""
|
|
github_oauth_client_secret: str = ""
|
|
|
|
# Standalone mode
|
|
standalone: bool = False # FLOWDECK_STANDALONE=true in .env
|
|
|
|
# OAuth2 — empty = dynamic per-request redirect URI (Host + X-Forwarded-*),
|
|
# set this ONLY to pin an exact URI (must be registered in Gitea/GitHub)
|
|
oauth_redirect_uri: str = ""
|
|
|
|
# Webhook
|
|
webhook_base_url: str = "http://localhost:8080"
|
|
|
|
# App
|
|
app_secret_key: str = "change-me-to-random"
|
|
app_host: str = "0.0.0.0"
|
|
app_port: int = 8080
|
|
log_level: str = "INFO"
|
|
default_lang: str = "fr"
|
|
|
|
# Rate limiting
|
|
rate_limit_enabled: bool = True
|
|
rate_limit_requests: int = 60 # per minute
|
|
|
|
# Database
|
|
database_url: str = "sqlite:////data/flowdeck.db"
|
|
|
|
# Sync
|
|
sync_interval: int = 60
|
|
gitea_cache_ttl: int = 30
|
|
|
|
# Backup (v5.2.0) — scheduled daily snapshot of the SQLite file
|
|
backup_enabled: bool = True
|
|
backup_dir: str = "/data/backups"
|
|
backup_interval_hours: int = 24
|
|
backup_keep: int = 30
|
|
|
|
# Forge projects sync (v5.2.0) — periodic refresh of `projects` table
|
|
project_sync_enabled: bool = True
|
|
project_sync_interval_hours: int = 1
|
|
|
|
# Email / SMTP notifications (v4.9.0) — optional. If smtp_host is empty,
|
|
# email notifications are skipped (only in-app notifications are delivered).
|
|
smtp_host: str = ""
|
|
smtp_port: int = 587
|
|
smtp_user: str = ""
|
|
smtp_password: str = ""
|
|
smtp_from: str = "FlowDeck <[email protected]>"
|
|
smtp_use_tls: bool = True
|
|
app_base_url: str = "http://localhost:8080"
|
|
|
|
# FlowDeck Agent (v4.10.0) — multi-LLM. Empty keys → offline/mock mode
|
|
# (deterministic rule-based planner so the agent works without any API key).
|
|
agent_enabled: bool = True
|
|
llm_provider: str = "offline" # openai | anthropic | google | ollama |
|
|
# deepseek | qwencloud | nvidia | openrouter | offline
|
|
llm_model: str = "gpt-4o"
|
|
llm_api_key: str = ""
|
|
llm_api_base: str = "" # custom base URL (Ollama, OpenRouter, ...)
|
|
agent_max_iterations: int = 12
|
|
agent_max_tokens_budget: int = 500000
|
|
agent_run_timeout_seconds: int = 300
|
|
|
|
@property
|
|
def db_path(self) -> Path:
|
|
if self.database_url == "sqlite:///:memory:":
|
|
return Path(":memory:") # Special SQLite in-memory
|
|
if self.database_url.startswith("sqlite:///"):
|
|
p = self.database_url.replace("sqlite:///", "", 1)
|
|
# On Windows, don't prepend / if path starts with a drive letter
|
|
import re
|
|
if re.match(r'^[a-zA-Z]:', p):
|
|
return Path(p)
|
|
return Path("/" + p)
|
|
return Path("/data/flowdeck.db")
|
|
|
|
|
|
settings = Settings()
|