- Add runtime_config.php: credential store backed by runtime_config.json (gitignored). Falls back to .env values so existing envs need no migration. - Add admin_api.php: status / test_kling / update_kling endpoints gated behind ADMIN_EMAILS allowlist. Accepts Bearer idToken when SSO enabled; uses mock dev@localhost when SSO disabled. - config.php: replace KLING_ACCESS_KEY/SECRET_KEY defines with ADMIN_EMAILS - kling_api.php: read credentials via getKlingCredentials() on every request so rotations take effect immediately without a server restart - All .env templates: add ADMIN_EMAILS= (dev@localhost populated in .env.local) - AdminSettings.jsx: modal with masked status, Test Connection, Save Credentials - AppContent.jsx: admin status check on mount; Settings gear shown to admins - Fix production URL in .env.production/.env.example (optical-prod.oliver.solutions) - .gitignore: exclude backend/runtime_config.json Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
35 lines
954 B
PHP
35 lines
954 B
PHP
<?php
|
|
/**
|
|
* Runtime configuration - reads all settings from the .env file.
|
|
* No secrets are stored here; keep this file committed to git.
|
|
*/
|
|
|
|
if (file_exists(__DIR__ . '/env_loader.php')) {
|
|
require_once __DIR__ . '/env_loader.php';
|
|
}
|
|
|
|
// Google Gemini
|
|
define('GEMINI_API_KEY', getenv('GEMINI_API_KEY') ?: '');
|
|
|
|
// Admin — comma-separated list of authorized admin email addresses (UPNs)
|
|
define('ADMIN_EMAILS', getenv('ADMIN_EMAILS') ?: '');
|
|
|
|
// Azure AD SSO
|
|
if (!defined('SSO_ENABLED')) {
|
|
define('SSO_ENABLED', getenv('SSO_ENABLED') === 'true');
|
|
}
|
|
if (!defined('SSO_TENANT_ID')) {
|
|
define('SSO_TENANT_ID', getenv('SSO_TENANT_ID') ?: '');
|
|
}
|
|
if (!defined('SSO_CLIENT_ID')) {
|
|
define('SSO_CLIENT_ID', getenv('SSO_CLIENT_ID') ?: '');
|
|
}
|
|
|
|
// Session lifetime
|
|
ini_set('session.gc_maxlifetime', 3600);
|
|
ini_set('session.cookie_lifetime', 3600);
|
|
|
|
// Error reporting
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 0);
|
|
ini_set('log_errors', 1);
|