debug
This commit is contained in:
@@ -1 +1 @@
|
||||
1.2.11
|
||||
1.2.12
|
||||
@@ -25,6 +25,20 @@ if (!$bootstrapLoaded) {
|
||||
$overrides = $GLOBALS['EMAILTEMPLATE_OVERRIDES'] ?? [];
|
||||
|
||||
$env = (string)($overrides['env'] ?? (defined('APP_ENV') ? APP_ENV : (getenv('APP_ENV') ?: 'local')));
|
||||
$host = '';
|
||||
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||
$host = strtolower(trim(explode(',', (string)$_SERVER['HTTP_X_FORWARDED_HOST'])[0]));
|
||||
} elseif (!empty($_SERVER['HTTP_HOST'])) {
|
||||
$host = strtolower((string)$_SERVER['HTTP_HOST']);
|
||||
}
|
||||
if ($host !== '') {
|
||||
$host = preg_replace('/:\\d+$/', '', $host);
|
||||
if ($host === 'staging.emailtemplate.it') {
|
||||
$env = 'staging';
|
||||
} elseif (preg_match('/(^|\\.)emailtemplate\\.it$/', $host)) {
|
||||
$env = 'prod';
|
||||
}
|
||||
}
|
||||
$baseUrl = (string)($overrides['base_url'] ?? (defined('APP_URL_PRIMARY') ? APP_URL_PRIMARY : (getenv('APP_BASE_URL') ?: '')));
|
||||
$cookieDomainDefault = (string)($overrides['cookie_domain'] ?? ($overrides['auth']['cookie_domain'] ?? (defined('APP_COOKIE_DOMAIN') ? APP_COOKIE_DOMAIN : (defined('APP_DOMAIN_PRIMARY') ? '.' . APP_DOMAIN_PRIMARY : ''))));
|
||||
$sessionNameDefault = (string)($overrides['session_name'] ?? ($overrides['auth']['session_name'] ?? (defined('APP_COOKIE_PREFIX') ? APP_COOKIE_PREFIX . 'session' : 'et_session')));
|
||||
|
||||
@@ -10,6 +10,22 @@ $envHint = getenv('APP_ENV_FILE') ?: (getenv('APP_ENV') ?: null);
|
||||
if ($envHint && !preg_match('/^[A-Za-z0-9_\-]+$/', $envHint)) {
|
||||
$envHint = null;
|
||||
}
|
||||
if ($envHint === null) {
|
||||
$host = '';
|
||||
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||
$host = strtolower(trim(explode(',', (string)$_SERVER['HTTP_X_FORWARDED_HOST'])[0]));
|
||||
} elseif (!empty($_SERVER['HTTP_HOST'])) {
|
||||
$host = strtolower((string)$_SERVER['HTTP_HOST']);
|
||||
}
|
||||
if ($host !== '') {
|
||||
$host = preg_replace('/:\\d+$/', '', $host);
|
||||
if ($host === 'staging.emailtemplate.it') {
|
||||
$envHint = 'staging';
|
||||
} elseif (preg_match('/(^|\\.)emailtemplate\\.it$/', $host)) {
|
||||
$envHint = 'prod';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($envHint === null) {
|
||||
if (is_dir(__DIR__ . '/staging')) {
|
||||
$envHint = 'staging';
|
||||
|
||||
Reference in New Issue
Block a user