cc-dashboard/src/config.py
Vadym Samoilenko 96e6f4ee14 feat: replace local auth with Azure AD SSO (MSAL PKCE)
- New POST /api/auth/microsoft endpoint validates Azure ID token via JWKS
- Removed POST /api/auth/login and /change-password
- Added azure_oid + nullable password_hash to users (migration 0007)
- Auto-provisions all @oliver.agency accounts on first SSO login
- Case-insensitive email matching links existing vadymsamoilenko@ account
- DEV_AUTH_BYPASS flag for local development without MSAL
- Frontend: MSAL loginPopup replaces email/password form
- Added scripts/grant_admin.py for role management

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 10:43:19 +01:00

59 lines
1.6 KiB
Python

from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
# DB
DB_PASSWORD: str = "postgres"
DATABASE_URL: str = ""
# JWT
SECRET_KEY: str = "dev_secret_key_change_in_production"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
# App
BASE_PATH: str = "/cc-dashboard"
APP_TITLE: str = "CC Dashboard"
DEBUG: bool = False
# Azure DevOps
ADO_ORGANIZATION: str = ""
ADO_PROJECT: str = ""
ADO_PAT: str = ""
ADO_SYNC_INTERVAL_MINUTES: int = 15
# Mailgun
MAILGUN_API_KEY: str = ""
MAILGUN_DOMAIN: str = ""
MAILGUN_FROM: str = "CC Dashboard <noreply@example.com>"
# AI Reports + Email
ANTHROPIC_API_KEY: str = ""
REPORT_EMAIL: str = ""
DAILY_REPORT_HOUR: int = 20
WEEKLY_REPORT_DAY: int = 6 # 0=Mon ... 6=Sun
WEEKLY_REPORT_HOUR: int = 21
# Azure AD SSO
AZURE_TENANT_ID: str = ""
AZURE_CLIENT_ID: str = ""
ALLOWED_EMAIL_DOMAIN: str = "oliver.agency"
ADMIN_EMAILS: str = "" # comma-separated lowercase
DEV_AUTH_BYPASS: bool = False
DEV_USER_EMAIL: str = "vadymsamoilenko@oliver.agency"
# Logging
LOG_FORMAT: str = "console" # "json" or "console"
def model_post_init(self, __context):
if not self.DATABASE_URL:
object.__setattr__(
self,
"DATABASE_URL",
f"postgresql+asyncpg://cc_app:{self.DB_PASSWORD}@db:5432/cc_dashboard",
)
settings = Settings()