Fix config to always define SSO constants

Updated config.example.php to match working config structure:

Changes:
- Load env_loader.php with file_exists check
- Always define SSO_ENABLED, SSO_TENANT_ID, SSO_CLIENT_ID
- Use !defined() checks to prevent redefinition errors
- Defaults to false/empty if .env not found
- Added error reporting settings

Server-check.php improvements:
- Shows actual SSO constant values (TRUE/FALSE/EMPTY)
- Better diagnostic output

DEPLOYMENT FIX:
On server, update config.php to match config.example.php structure.
This ensures SSO constants are always defined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
DJP 2025-12-16 11:23:47 -05:00
parent 20f1a16bb0
commit f7ea6006db
2 changed files with 26 additions and 2 deletions

View file

@ -2,13 +2,35 @@
/**
* Configuration file for Nano Banana Pro Image Generator
*
* Copy this file to config.php and add your API key
* IMPORTANT: Copy this file to config.php and add your Google Gemini API key
*/
// Load environment variables from .env file
if (file_exists(__DIR__ . '/env_loader.php')) {
require_once __DIR__ . '/env_loader.php';
}
// Google Gemini API Key (Nano Banana Pro)
// Get your API key from: https://aistudio.google.com/app/apikey
define('GEMINI_API_KEY', 'YOUR_API_KEY_HERE');
// MSAL / Azure AD SSO Configuration
// Always define these constants with defaults if not set
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 configuration
ini_set('session.gc_maxlifetime', 3600); // 1 hour
ini_set('session.cookie_lifetime', 3600);
// Error reporting (set to 0 in production)
error_reporting(E_ALL);
ini_set('display_errors', 1); // Temporarily enabled for debugging
ini_set('log_errors', 1);

View file

@ -101,7 +101,9 @@ header('Content-Type: text/html; charset=utf-8');
require_once __DIR__ . '/config.php';
echo "<pre class='success'>✓ config.php loaded successfully</pre>";
echo "<pre> GEMINI_API_KEY: " . (defined('GEMINI_API_KEY') && !empty(GEMINI_API_KEY) ? '✓ SET' : '✗ NOT SET') . "</pre>";
echo "<pre> SSO_ENABLED: " . (defined('SSO_ENABLED') ? (SSO_ENABLED ? 'TRUE' : 'FALSE') : '✗ NOT SET') . "</pre>";
echo "<pre> SSO_ENABLED: " . (defined('SSO_ENABLED') ? (SSO_ENABLED ? 'TRUE' : 'FALSE') : '✗ NOT DEFINED') . "</pre>";
echo "<pre> SSO_TENANT_ID: " . (defined('SSO_TENANT_ID') ? (SSO_TENANT_ID ? '✓ SET' : 'EMPTY') : '✗ NOT DEFINED') . "</pre>";
echo "<pre> SSO_CLIENT_ID: " . (defined('SSO_CLIENT_ID') ? (SSO_CLIENT_ID ? '✓ SET' : 'EMPTY') : '✗ NOT DEFINED') . "</pre>";
} else {
echo "<pre class='error'>✗ config.php missing</pre>";
}