diff --git a/system/pancake/config/constants.php b/system/pancake/config/constants.php index 514e941..5661c33 100755 --- a/system/pancake/config/constants.php +++ b/system/pancake/config/constants.php @@ -41,6 +41,15 @@ define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); require 'base_url.php'; $details = detect_base_url($_SERVER, FCPATH); + +// Allow overriding the detected base URL via environment variable. +$envBaseUrl = getenv('PANCAKE_BASE_URL'); +if ($envBaseUrl !== false && $envBaseUrl !== '') { + $envBaseUrl = rtrim($envBaseUrl, '/') . '/'; + $details['url'] = $envBaseUrl; + $details['is_ssl'] = (stripos($envBaseUrl, 'https://') === 0); +} + define('BASE_URL', $details['url']); define('IS_SSL', $details['is_ssl']); define('SCHEME', IS_SSL ? 'https' : 'http');