mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 15:25:41 +08:00
chore
This commit is contained in:
@@ -15,6 +15,8 @@ class GlobalEnvManager
|
||||
{
|
||||
private static array $env_cache = [];
|
||||
|
||||
private static bool $initialized = false;
|
||||
|
||||
public static function getInitializedEnv(): array
|
||||
{
|
||||
return self::$env_cache;
|
||||
@@ -28,6 +30,9 @@ class GlobalEnvManager
|
||||
*/
|
||||
public static function init(): void
|
||||
{
|
||||
if (self::$initialized) {
|
||||
return;
|
||||
}
|
||||
// Check pre-defined env vars exists
|
||||
if (getenv('BUILD_ROOT_PATH') === false) {
|
||||
throw new RuntimeException('You must include src/globals/internal-env.php before using GlobalEnvManager');
|
||||
@@ -85,6 +90,7 @@ class GlobalEnvManager
|
||||
self::putenv("{$k}={$v}");
|
||||
}
|
||||
}
|
||||
self::$initialized = true;
|
||||
}
|
||||
|
||||
public static function putenv(string $val): void
|
||||
|
||||
Reference in New Issue
Block a user