diff --git a/src/app/config/ProfileManager.php b/src/app/config/ProfileManager.php index b30d71e..0d380e1 100644 --- a/src/app/config/ProfileManager.php +++ b/src/app/config/ProfileManager.php @@ -41,13 +41,19 @@ class ProfileManager { $this->productionModes = static::PRODUCTION_MODES; $this->profileMap = static::PROFILE_MAP; $name = $params["name"] ?? static::NAME; - $configKey = "${name}_profile"; - $envKey = strtoupper($configKey); - if ($this->isAppProfile) { - $this->envKeys = [$envKey, "APP_PROFILE"]; + if ($name === null) { + $this->configKey = null; + $this->envKeys = ["APP_PROFILE"]; } else { - $this->configKey = $configKey; - $this->envKeys = [$envKey]; + $configKey = "${name}_profile"; + $envKey = strtoupper($configKey); + if ($this->isAppProfile) { + $this->configKey = null; + $this->envKeys = [$envKey, "APP_PROFILE"]; + } else { + $this->configKey = $configKey; + $this->envKeys = [$envKey]; + } } } @@ -66,14 +72,14 @@ class ProfileManager { return $this->profileMap[$profile] ?? $profile; } - protected ?string $configKey = null; + protected ?string $configKey; function getConfigProfile(): ?string { if ($this->configKey === null) return null; return config::k($this->configKey); } - protected array $envKeys = []; + protected array $envKeys; function getEnvProfile(): ?string { foreach ($this->envKeys as $envKey) {