Add Multi-Tenant SaaS foundation for customer management

Phase 1 implementation includes:

Database:
- schema.sql with tables for tenants, domains, settings, branding,
  streams, users, subscriptions, plans, invoices, viewer_stats

Core Classes (src/Core/):
- Database.php: PDO wrapper with singleton pattern
- TenantResolver.php: Domain-to-tenant resolution with fallback

Tenant Classes (src/Tenant/):
- TenantManager.php: CRUD operations for tenants
- TenantSettingsManager.php: DB-based settings per tenant

Configuration:
- config.example.php: Template for database/stripe/mail config
- bootstrap.php: Initializes multi-tenant environment
- .gitignore: Excludes config.php and cache files

Integration:
- SettingsManager.php: Added saas_features toggles (all off by default)
- index.php: Uses getSiteConfig() from bootstrap when multi-tenant enabled,
  falls back to legacy hardcoded domains when disabled

All SaaS features are disabled by default (saas_features.multi_tenant_enabled = false),
ensuring zero breaking changes to existing installations.
This commit is contained in:
Claude
2026-01-23 16:40:42 +00:00
parent 328b5b5b15
commit 402604b4cc
10 changed files with 1993 additions and 46 deletions
+59
View File
@@ -0,0 +1,59 @@
<?php
/**
* Aurora Livecam - Konfigurationsdatei
*
* Kopiere diese Datei zu config.php und passe die Werte an.
* WICHTIG: config.php niemals in Git committen!
*/
return [
// Datenbank-Konfiguration
'database' => [
'host' => 'localhost',
'port' => 3306,
'database' => 'aurora_livecam',
'username' => 'root',
'password' => '',
'charset' => 'utf8mb4',
],
// Anwendungs-Einstellungen
'app' => [
'name' => 'Aurora Livecam',
'url' => 'https://aurora-weather-livecam.com',
'debug' => false,
'timezone' => 'Europe/Zurich',
],
// Multi-Tenant Einstellungen
'tenant' => [
'default_subdomain_suffix' => '.aurora-livecam.com',
'allow_custom_domains' => true,
'trial_days' => 14,
],
// Stripe (für Billing)
'stripe' => [
'public_key' => '',
'secret_key' => '',
'webhook_secret' => '',
'currency' => 'chf',
],
// E-Mail Einstellungen (für Onboarding)
'mail' => [
'host' => 'smtp.example.com',
'port' => 587,
'username' => '',
'password' => '',
'from_address' => 'noreply@aurora-livecam.com',
'from_name' => 'Aurora Livecam',
],
// Sicherheit
'security' => [
'session_lifetime' => 7200, // 2 Stunden
'remember_me_days' => 30,
'password_min_length' => 8,
],
];