From f7ea6006db3f9c40e4f144080afc14584eb429e8 Mon Sep 17 00:00:00 2001 From: DJP Date: Tue, 16 Dec 2025 11:23:47 -0500 Subject: [PATCH] Fix config to always define SSO constants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- config.example.php | 24 +++++++++++++++++++++++- server-check.php | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/config.example.php b/config.example.php index 91d1f7c..5ef3bd4 100644 --- a/config.example.php +++ b/config.example.php @@ -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); diff --git a/server-check.php b/server-check.php index e39ddc7..9a86323 100644 --- a/server-check.php +++ b/server-check.php @@ -101,7 +101,9 @@ header('Content-Type: text/html; charset=utf-8'); require_once __DIR__ . '/config.php'; echo "
✓ config.php loaded successfully
"; echo "
  GEMINI_API_KEY: " . (defined('GEMINI_API_KEY') && !empty(GEMINI_API_KEY) ? '✓ SET' : '✗ NOT SET') . "
"; - echo "
  SSO_ENABLED: " . (defined('SSO_ENABLED') ? (SSO_ENABLED ? 'TRUE' : 'FALSE') : '✗ NOT SET') . "
"; + echo "
  SSO_ENABLED: " . (defined('SSO_ENABLED') ? (SSO_ENABLED ? 'TRUE' : 'FALSE') : '✗ NOT DEFINED') . "
"; + echo "
  SSO_TENANT_ID: " . (defined('SSO_TENANT_ID') ? (SSO_TENANT_ID ? '✓ SET' : 'EMPTY') : '✗ NOT DEFINED') . "
"; + echo "
  SSO_CLIENT_ID: " . (defined('SSO_CLIENT_ID') ? (SSO_CLIENT_ID ? '✓ SET' : 'EMPTY') : '✗ NOT DEFINED') . "
"; } else { echo "
✗ config.php missing
"; }