a3546b4c01
- Move all credentials from hardcoded to .env with python-dotenv (add .env.example template and .gitignore) - Add CSRF token generation and validation on all state-changing requests - Replace random.choices with secrets.choice for all secure code generation - Add session cookie security headers (HttpOnly, Secure, SameSite) - Add presenter management: assign/remove presenters to breakout sessions, presenter QR scanning - Add email communications system: templates per event, custom email sending, sent email tracking - Add staff/organizer profile pages with staff code display - New DB tables: event_email_templates, sent_emails, user_communications - New DB columns: staff.reminder_count/reminder_dates, breakout_session_organizers.presenter_code - Expand English translation strings across all new features Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
|
|
import os
|
|
|
|
class Config:
|
|
# Internationalization
|
|
BABEL_DEFAULT_LOCALE = 'en'
|
|
BABEL_SUPPORTED_LOCALES = ['en', 'nl', 'de', 'fr', 'es', 'it', 'pl']
|
|
BABEL_TRANSLATION_DIRECTORIES = 'translations'
|
|
|
|
# Security
|
|
SECRET_KEY = os.environ.get('SECRET_KEY')
|
|
SESSION_COOKIE_HTTPONLY = True
|
|
SESSION_COOKIE_SECURE = os.environ.get('SESSION_COOKIE_SECURE', 'false').lower() == 'true'
|
|
SESSION_COOKIE_SAMESITE = 'Lax'
|
|
|
|
# MySQL Database Configuration
|
|
DB_HOST = os.environ.get('DB_HOST', 'localhost')
|
|
DB_PORT = int(os.environ.get('DB_PORT', '3306'))
|
|
DB_USER = os.environ.get('DB_USER', 'root')
|
|
DB_PASSWORD = os.environ.get('DB_PASSWORD')
|
|
DB_NAME = os.environ.get('DB_NAME', 'netevent')
|
|
|
|
# Dedicated database user (created by init_db.py)
|
|
DB_APP_USER = os.environ.get('DB_APP_USER', 'netevent_app')
|
|
DB_APP_PASSWORD = os.environ.get('DB_APP_PASSWORD')
|
|
|
|
# Email Configuration (Brevo/Sendinblue)
|
|
MAIL_SERVER = os.environ.get('MAIL_SERVER', 'smtp-relay.brevo.com')
|
|
MAIL_PORT = int(os.environ.get('MAIL_PORT', '587'))
|
|
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS', 'true').lower() == 'true'
|
|
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
|
|
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
|
|
MAIL_DEFAULT_SENDER = os.environ.get('MAIL_DEFAULT_SENDER', 'paul@bokel.nl')
|
|
|
|
UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static', 'uploads')
|
|
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max file size
|
|
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
|
|
|
|
# Google reCAPTCHA Configuration
|
|
RECAPTCHA_SITE_KEY = os.environ.get('RECAPTCHA_SITE_KEY', '')
|
|
RECAPTCHA_SECRET_KEY = os.environ.get('RECAPTCHA_SECRET_KEY', '')
|
|
|
|
# Debug mode - must be explicitly enabled
|
|
DEBUG = os.environ.get('FLASK_DEBUG', 'false').lower() == 'true'
|