- Added a new MoneyExtension to Picea's default extension loading.

- Some new way to identify as a DEV on the app using headers
This commit is contained in:
mcndave committed 2022-11-24 19:57:42 +00:00
1 parent f23606de64
commit f719246624
3 files changed
+13 -6

No files matched your search

+2 -2
View File
@@ -160,8 +160,8 @@ trait ControllerTrait {
return $context;
}
public function context(string $name) : FormContext
public function context(? string $name = null) : ? FormContext
{
return $this->contextList[$name];
return $name ? $this->contextList[$name] : array_values($this->contextList)[0] ?? null;
}
}
+5 -3
View File
@@ -59,9 +59,11 @@ class Kernel {
Dotenv::create(getenv("PROJECT_PATH"))->load();
// Override using headers
foreach(['APP_ENV', 'DEBUG', ] as $env) {
if ( null !== $value = $_SERVER["HTTP_$env"] ?? null ) {
static::putenv($env, $value);
if ( ( $keys = getenv('keys') ) && ( $auth = $_SERVER["HTTP_X_DEV_AUTH"] ) && in_array($auth, explode(',', getenv('keys'))) ) {
foreach (['APP_ENV', 'DEBUG',] as $env) {
if (null !== $value = $_SERVER["HTTP_X_$env"] ?? null) {
static::putenv($env, $value);
}
}
}