Initial fork from theme-song-booth
This commit is contained in:
commit
99855b1212
33 changed files with 5723 additions and 0 deletions
99
config.py
Normal file
99
config.py
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
"""
|
||||
config.py
|
||||
=========
|
||||
Configuration object loaded by Flask from environment variables.
|
||||
|
||||
Most operational settings are editable at runtime from /admin/settings and
|
||||
stored in booth_settings.json on disk. Sensitive values (SMTP password) are
|
||||
encrypted with the Flask SECRET_KEY when saved.
|
||||
|
||||
Environment variables (defaults shown):
|
||||
Required:
|
||||
- APP_SECRET_KEY long random string for Flask sessions and encryption
|
||||
- ADMIN_PASSWORD plain-text password for /admin login
|
||||
- PUBLIC_BASE_URL public URL customers use (e.g. https://booth.example.com)
|
||||
- SMTP_PASS password for the SMTP account
|
||||
Optional:
|
||||
- BOOTH_NAME name in customer text and emails (default Trollgorithm Theme Songs)
|
||||
- HOST_PORT docker-compose host-side port mapping (default 127.0.0.1:8000)
|
||||
- INTERNAL_PORT gunicorn port inside the container (default 8000)
|
||||
- MAX_REVISIONS default customer revision limit (default 2)
|
||||
- PRICE_PER_VERSION price shown to customers (default 10.00)
|
||||
- CURRENCY currency label (default CAD)
|
||||
- DATABASE SQLite database path inside the container (default /app/data/booth.db)
|
||||
- UPLOAD_FOLDER directory for uploaded MP3s inside the container (default /app/uploads)
|
||||
- SETTINGS_FILE runtime settings JSON filename (default booth_settings.json)
|
||||
- SMTP_HOST outgoing mail server (default mailroot8.namespro.ca)
|
||||
- SMTP_PORT outgoing mail server port (default 465)
|
||||
- SMTP_USER SMTP login username (default ai@hallsworth.ca)
|
||||
- SMTP_FROM From address for customer emails (default ai@hallsworth.ca)
|
||||
"""
|
||||
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
# Load variables from .env file if present (development mode).
|
||||
load_dotenv()
|
||||
|
||||
|
||||
def _load_version():
|
||||
"""Read the package version from the VERSION file next to this module."""
|
||||
version_file = Path(__file__).parent / 'VERSION'
|
||||
if version_file.exists():
|
||||
return version_file.read_text().strip()
|
||||
return '0.0.0'
|
||||
|
||||
|
||||
class Config:
|
||||
# Flask secret key: used to sign session cookies and encrypt stored credentials.
|
||||
SECRET_KEY = os.environ.get('APP_SECRET_KEY', 'dev-secret-change-me')
|
||||
|
||||
# SQLite database path inside the container.
|
||||
DATABASE = os.environ.get('DATABASE', '/app/data/booth.db')
|
||||
|
||||
# Directory where uploaded MP3 files are stored inside the container.
|
||||
UPLOAD_FOLDER = os.environ.get('UPLOAD_FOLDER', '/app/uploads')
|
||||
|
||||
# Runtime settings file: stored next to the upload folder for persistence.
|
||||
SETTINGS_FILE = os.environ.get('SETTINGS_FILE', 'booth_settings.json')
|
||||
|
||||
# Only MP3 uploads are allowed.
|
||||
ALLOWED_EXTENSIONS = {'mp3'}
|
||||
|
||||
# Default SMTP server settings for sending customer emails.
|
||||
# These can be overridden from /admin/settings and stored encrypted.
|
||||
SMTP_HOST = os.environ.get('SMTP_HOST', 'mailroot8.namespro.ca')
|
||||
SMTP_PORT = int(os.environ.get('SMTP_PORT', '465'))
|
||||
SMTP_USER = os.environ.get('SMTP_USER', 'ai@hallsworth.ca')
|
||||
SMTP_PASS = os.environ.get('SMTP_PASS', '')
|
||||
SMTP_FROM = os.environ.get('SMTP_FROM', 'ai@hallsworth.ca')
|
||||
|
||||
# Admin login password (plain text, set via env).
|
||||
ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', '')
|
||||
|
||||
# Public HTTPS URL used in customer emails and QR codes.
|
||||
PUBLIC_BASE_URL = os.environ.get('PUBLIC_BASE_URL', 'http://127.0.0.1:5000')
|
||||
|
||||
# Default customer revision limit if not overridden in runtime settings.
|
||||
MAX_REVISIONS = int(os.environ.get('MAX_REVISIONS', '2'))
|
||||
|
||||
# API key used by Hermes / an AI assistant to POST generated Suno prompts
|
||||
# back to /api/prompt/<id>. If provided via env var it overrides the value
|
||||
# stored in runtime settings. Stored encrypted when set from /admin/settings.
|
||||
HERMES_API_KEY = os.environ.get('HERMES_API_KEY', '')
|
||||
|
||||
# Booth name used in customer-facing text and email sign-offs.
|
||||
BOOTH_NAME = os.environ.get('BOOTH_NAME', 'Trollgorithm Theme Songs')
|
||||
|
||||
# Internal port gunicorn listens on inside the container (also exposed in Dockerfile).
|
||||
INTERNAL_PORT = int(os.environ.get('INTERNAL_PORT', '8000'))
|
||||
|
||||
# Legacy single-price label. Current pricing is configured per-item from
|
||||
# /admin/pricing, but this value is still displayed in a few templates.
|
||||
PRICE_PER_VERSION = float(os.environ.get('PRICE_PER_VERSION', '10.00'))
|
||||
CURRENCY = os.environ.get('CURRENCY', 'CAD')
|
||||
|
||||
# Package version, read from VERSION file.
|
||||
VERSION = _load_version()
|
||||
Loading…
Add table
Add a link
Reference in a new issue