modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2025-10-01 18:35:06 +04:00
parent bed23c9425
commit 2456a48b38

View File

@ -41,13 +41,19 @@ class ProfileManager {
$this->productionModes = static::PRODUCTION_MODES; $this->productionModes = static::PRODUCTION_MODES;
$this->profileMap = static::PROFILE_MAP; $this->profileMap = static::PROFILE_MAP;
$name = $params["name"] ?? static::NAME; $name = $params["name"] ?? static::NAME;
$configKey = "${name}_profile"; if ($name === null) {
$envKey = strtoupper($configKey); $this->configKey = null;
if ($this->isAppProfile) { $this->envKeys = ["APP_PROFILE"];
$this->envKeys = [$envKey, "APP_PROFILE"];
} else { } else {
$this->configKey = $configKey; $configKey = "${name}_profile";
$this->envKeys = [$envKey]; $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; return $this->profileMap[$profile] ?? $profile;
} }
protected ?string $configKey = null; protected ?string $configKey;
function getConfigProfile(): ?string { function getConfigProfile(): ?string {
if ($this->configKey === null) return null; if ($this->configKey === null) return null;
return config::k($this->configKey); return config::k($this->configKey);
} }
protected array $envKeys = []; protected array $envKeys;
function getEnvProfile(): ?string { function getEnvProfile(): ?string {
foreach ($this->envKeys as $envKey) { foreach ($this->envKeys as $envKey) {