Skip to content

Commit 8cd9b58

Browse files
committed
Change how environment and debug kernel parameters are determined.
1 parent fc5103f commit 8cd9b58

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/functions.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class_alias('Drupal\\drufony\\Drufony', 'Drufony');
1717
$class = variable_get('drufony_kernel_class', 'Drupal\\drufony\\DrupalKernel');
1818

1919
/** @var KernelInterface $kernel */
20-
$kernel = new $class(get_environment(), get_debug());
20+
$kernel = new $class($_SERVER['APP_ENV'] ?? get_environment(), $_SERVER['APP_DEBUG'] ?? get_debug());
2121
$kernel->boot();
2222
$container = $kernel->getContainer();
2323
Drufony::setContainer($container);
@@ -28,17 +28,17 @@ class_alias('Drupal\\drufony\\Drufony', 'Drufony');
2828
*
2929
* @return string
3030
*/
31-
function get_environment($varname = 'AH_SITE_ENVIRONMENT', $default = 'local')
31+
function get_environment($varname = 'AH_SITE_ENVIRONMENT', $default = 'dev')
3232
{
33-
return getenv($varname) ?: $default;
33+
return getenv($varname) ? 'prod' : $default;
3434
}
3535

3636
/**
37-
* Kernel debug is true unless this is the production environment.
37+
* Kernel debug is true unless this is the test or prod environments.
3838
*
39-
* @return boolean
39+
* @return bool
4040
*/
41-
function get_debug($varname = 'AH_PRODUCTION', $default = true)
41+
function get_debug($varname = 'AH_SITE_ENVIRONMENT', $default = true)
4242
{
43-
return getenv($varname) ? false : $default;
43+
return getenv($varname) === 'test' || getenv($varname) === 'prod' ? false : $default;
4444
}

0 commit comments

Comments
 (0)