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,15 +41,21 @@ 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;
if ($name === null) {
$this->configKey = null;
$this->envKeys = ["APP_PROFILE"];
} else {
$configKey = "${name}_profile"; $configKey = "${name}_profile";
$envKey = strtoupper($configKey); $envKey = strtoupper($configKey);
if ($this->isAppProfile) { if ($this->isAppProfile) {
$this->configKey = null;
$this->envKeys = [$envKey, "APP_PROFILE"]; $this->envKeys = [$envKey, "APP_PROFILE"];
} else { } else {
$this->configKey = $configKey; $this->configKey = $configKey;
$this->envKeys = [$envKey]; $this->envKeys = [$envKey];
} }
} }
}
/** /**
* @var bool cet objet est-il utilisé pour gérer le profil de l'application? * @var bool cet objet est-il utilisé pour gérer le profil de l'application?
@ -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) {