- removed getenvonce, placed in env dir instead
This commit is contained in:
parent
77a13960f2
commit
c181cdfb28
@ -11,16 +11,13 @@ use League\Route\Strategy\ApplicationStrategy;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
use Tell\I18n;
|
||||
use Ulmus\Container\AdapterProxy;
|
||||
|
||||
use Laminas\Diactoros\ServerRequestFactory,
|
||||
Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
|
||||
|
||||
use Ulmus\Ulmus;
|
||||
|
||||
class Kernel {
|
||||
|
||||
class Kernel
|
||||
{
|
||||
protected Container $container;
|
||||
|
||||
protected string $locale;
|
||||
@ -33,9 +30,11 @@ class Kernel {
|
||||
|
||||
public string $errorLogPath;
|
||||
|
||||
|
||||
public function __construct(
|
||||
public string $projectPath
|
||||
) {
|
||||
)
|
||||
{
|
||||
$this->setEnvironment();
|
||||
$this->initializeEngine();
|
||||
$this->setupContainer();
|
||||
@ -49,7 +48,8 @@ class Kernel {
|
||||
$_ENV[$var] = $value;
|
||||
}
|
||||
|
||||
protected function setEnvironment() {
|
||||
protected function setEnvironment() : void
|
||||
{
|
||||
static::putenv('PROJECT_PATH', $this->projectPath);
|
||||
|
||||
// Environment vars (accessible from \DI\env(), getenv(), $_ENV and $_SERVER)
|
||||
@ -57,6 +57,12 @@ class Kernel {
|
||||
|
||||
// Override using headers
|
||||
if (($keys = getenv('KEYS')) && ($auth = $_SERVER["HTTP_X_DEV_AUTH"] ?? null) && in_array($auth, explode(',', $keys))) {
|
||||
unset($_SERVER["HTTP_X_DEV_AUTH"]);
|
||||
|
||||
unset($_ENV[$name], $_SERVER[$name]);
|
||||
putenv("KEYS=");
|
||||
|
||||
|
||||
foreach(['APP_ENV', 'DEBUG',] as $env) {
|
||||
if (null !== $value = $_SERVER["HTTP_X_$env"] ?? null) {
|
||||
static::putenv($env, $value);
|
||||
@ -154,7 +160,6 @@ class Kernel {
|
||||
|
||||
# Must be removed from KERNEL !
|
||||
$this->container->has('ulmus.caching') and (Ulmus::$cache = $this->container->get('ulmus.caching'));
|
||||
# $this->container->has(AdapterProxy::class) and ( $ )
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -177,4 +182,4 @@ class Kernel {
|
||||
|
||||
return $this;
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user