- Refresh app.py module and route docstrings for runtime settings, MP3 tagging, rate limiting, revision workflow, and admin actions. - Clarify config.py and models.py comments. - Update template comments/CSS for dashboard filters, request detail, player page, and settings page. - Rewrite README.md with current features, status flow, file layout, deployment variables, and troubleshooting. - Refresh REVIEW.md quick-reference. - Add MAX_REVISIONS to docker-compose.yml environment list. - Expand requirements.txt comment coverage. No version history or changelog included.
61 lines
2.4 KiB
Python
61 lines
2.4 KiB
Python
"""
|
|
config.py
|
|
=========
|
|
Configuration object loaded by Flask from environment variables.
|
|
|
|
Most operational settings are now editable at runtime from /admin/settings
|
|
and stored in booth_settings.json on disk. Sensitive email credentials are
|
|
encrypted with the Flask SECRET_KEY when saved.
|
|
|
|
Required environment values:
|
|
- APP_SECRET_KEY (used to sign sessions and encrypt stored settings)
|
|
- ADMIN_PASSWORD (plain-text login password)
|
|
- PUBLIC_BASE_URL
|
|
"""
|
|
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
# Load variables from .env file if present (development mode).
|
|
load_dotenv()
|
|
|
|
|
|
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')
|
|
|
|
# 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'))
|
|
|
|
# Informational price shown to the operator/customer; actual payment is collected manually (e.g. Square).
|
|
PRICE_PER_VERSION = float(os.environ.get('PRICE_PER_VERSION', '10.00'))
|
|
CURRENCY = os.environ.get('CURRENCY', 'CAD')
|