Config: - Fixed SQLite path parsing on Windows (handle drive letters without prepending /) - Changed default theme from dark to light - Updated OAuth test credentials (gitea_oauth_client_id/secret) Auth: - First real user (excluding default admin with no password) becomes admin - Changed user count query to exclude users without password_hash File viewer: - Removed separate _render_file_viewer() —
66 lines
1.8 KiB
Python
66 lines
1.8 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
|
|
oauth_redirect_uri: str = "http://localhost:8080/auth/callback"
|
|
|
|
# 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
|
|
|
|
@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()
|