This repository has been archived on 2026-09-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
theme-song-booth/config.py

61 lines
2.3 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 email sign-offs.
BOOTH_NAME = os.environ.get('BOOTH_NAME', 'Trollgorithm Theme Songs')
# Internal port gunicorn listens on inside the container.
INTERNAL_PORT = int(os.environ.get('INTERNAL_PORT', '8000'))
# Price per version shown on the receipt page (informational only; payment is manual).
PRICE_PER_VERSION = float(os.environ.get('PRICE_PER_VERSION', '10.00'))
CURRENCY = os.environ.get('CURRENCY', 'CAD')