2025-11-09 23:29:07 +01:00
|
|
|
import os
|
2025-11-10 15:46:40 +01:00
|
|
|
import sys
|
2025-11-09 23:29:07 +01:00
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
2025-11-13 23:22:05 +01:00
|
|
|
|
2025-11-09 23:29:07 +01:00
|
|
|
class Settings(BaseSettings):
|
2025-11-13 23:22:05 +01:00
|
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
2025-11-29 11:17:47 +01:00
|
|
|
|
|
|
|
|
RATE_LIMIT_ENABLED: bool = False
|
chore: rebrand all user-facing strings from RBox to MyWebdav across docs, emails, and config
Replace every occurrence of "RBox" with "MyWebdav" in README.md, invoice templates, welcome emails, share notifications, FastAPI metadata, default database filename, domain name, S3 bucket name, TOTP issuer, and WebDAV realm header to reflect the commercial rebranding of the application.
2025-11-13 12:05:05 +01:00
|
|
|
DATABASE_URL: str = "sqlite:///app/mywebdav.db"
|
2025-11-09 23:29:07 +01:00
|
|
|
REDIS_URL: str = "redis://redis:6379/0"
|
2025-11-10 15:46:40 +01:00
|
|
|
SECRET_KEY: str = "super_secret_key"
|
2025-11-09 23:29:07 +01:00
|
|
|
ALGORITHM: str = "HS256"
|
|
|
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
|
|
|
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
|
chore: rebrand all user-facing strings from RBox to MyWebdav across docs, emails, and config
Replace every occurrence of "RBox" with "MyWebdav" in README.md, invoice templates, welcome emails, share notifications, FastAPI metadata, default database filename, domain name, S3 bucket name, TOTP issuer, and WebDAV realm header to reflect the commercial rebranding of the application.
2025-11-13 12:05:05 +01:00
|
|
|
DOMAIN_NAME: str = "MyWebdav.eu"
|
2025-11-09 23:29:07 +01:00
|
|
|
CERTBOT_EMAIL: str = "admin@example.com"
|
2025-11-10 15:46:40 +01:00
|
|
|
STORAGE_PATH: str = "storage"
|
2025-11-09 23:29:07 +01:00
|
|
|
S3_ACCESS_KEY_ID: str | None = None
|
|
|
|
|
S3_SECRET_ACCESS_KEY: str | None = None
|
|
|
|
|
S3_ENDPOINT_URL: str | None = None
|
chore: rebrand all user-facing strings from RBox to MyWebdav across docs, emails, and config
Replace every occurrence of "RBox" with "MyWebdav" in README.md, invoice templates, welcome emails, share notifications, FastAPI metadata, default database filename, domain name, S3 bucket name, TOTP issuer, and WebDAV realm header to reflect the commercial rebranding of the application.
2025-11-13 12:05:05 +01:00
|
|
|
S3_BUCKET_NAME: str = "mywebdav-storage"
|
2025-11-11 15:20:14 +01:00
|
|
|
SMTP_HOST: str = "mail.example.com"
|
2025-11-10 15:46:40 +01:00
|
|
|
SMTP_PORT: int = 587
|
2025-11-11 15:20:14 +01:00
|
|
|
SMTP_USERNAME: str = "noreply@example.com"
|
|
|
|
|
SMTP_PASSWORD: str = "your-smtp-password"
|
|
|
|
|
SMTP_USE_TLS: bool = True
|
|
|
|
|
SMTP_SENDER_EMAIL: str = "noreply@example.com"
|
chore: rebrand all user-facing strings from RBox to MyWebdav across docs, emails, and config
Replace every occurrence of "RBox" with "MyWebdav" in README.md, invoice templates, welcome emails, share notifications, FastAPI metadata, default database filename, domain name, S3 bucket name, TOTP issuer, and WebDAV realm header to reflect the commercial rebranding of the application.
2025-11-13 12:05:05 +01:00
|
|
|
TOTP_ISSUER: str = "MyWebdav"
|
2025-11-10 15:46:40 +01:00
|
|
|
STRIPE_SECRET_KEY: str = ""
|
|
|
|
|
STRIPE_PUBLISHABLE_KEY: str = ""
|
|
|
|
|
STRIPE_WEBHOOK_SECRET: str = ""
|
|
|
|
|
BILLING_ENABLED: bool = False
|
2025-11-09 23:29:07 +01:00
|
|
|
|
feat: add admin panel with session auth, user management, and billing dashboard
Implement a full-featured admin backend at `/manage/` with login authentication using
signed cookies and constant-time credential verification. The panel includes a dashboard
showing total/active users, storage usage, monthly revenue, and pending invoices, plus
user management, payment overview, and pricing configuration pages. New environment
variables `ADMIN_USERNAME`, `ADMIN_PASSWORD`, `ADMIN_SESSION_SECRET`, and
`ADMIN_SESSION_EXPIRE_HOURS` control access. The admin router is registered in main.py
and all new templates, auth module, and router files are added.
2026-01-05 21:50:41 +01:00
|
|
|
ADMIN_USERNAME: str = "admin"
|
|
|
|
|
ADMIN_PASSWORD: str = "admin"
|
|
|
|
|
ADMIN_SESSION_SECRET: str = "admin_session_secret_change_me"
|
|
|
|
|
ADMIN_SESSION_EXPIRE_HOURS: int = 24
|
|
|
|
|
|
2025-11-13 23:22:05 +01:00
|
|
|
|
2025-11-09 23:29:07 +01:00
|
|
|
settings = Settings()
|
2025-11-10 15:46:40 +01:00
|
|
|
|
2025-11-13 23:22:05 +01:00
|
|
|
if (
|
|
|
|
|
settings.SECRET_KEY == "super_secret_key"
|
|
|
|
|
and os.getenv("ENVIRONMENT") == "production"
|
|
|
|
|
):
|
|
|
|
|
print(
|
|
|
|
|
"ERROR: Secret key must be changed in production. Set SECRET_KEY environment variable."
|
|
|
|
|
)
|
2025-11-10 15:46:40 +01:00
|
|
|
sys.exit(1)
|