fix: read Coolify config via config() (env() unreliable with config:cache + Octane)

This commit is contained in:
2026-05-07 07:02:05 +00:00
parent 4c6a3f7bc6
commit 0620e08351
3 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -83,8 +83,8 @@ class CompanyProvisioner
// Add subdomain to Coolify FQDN list + trigger redeploy. // Add subdomain to Coolify FQDN list + trigger redeploy.
$deployTriggered = false; $deployTriggered = false;
if ($this->coolify->isConfigured() && env('COOLIFY_APP_UUID')) { $appUuid = (string) config('services.coolify.app_uuid');
$appUuid = (string) env('COOLIFY_APP_UUID'); if ($this->coolify->isConfigured() && $appUuid !== '') {
$url = $company->url(''); $url = $company->url('');
$url = rtrim($url, '/') . ':8000'; // internal port suffix Coolify expects $url = rtrim($url, '/') . ':8000'; // internal port suffix Coolify expects
if ($this->coolify->addDomain($appUuid, $url)) { if ($this->coolify->addDomain($appUuid, $url)) {
+4 -2
View File
@@ -20,8 +20,10 @@ class CoolifyClient
protected ?string $base = null, protected ?string $base = null,
protected ?string $token = null, protected ?string $token = null,
) { ) {
$this->base = rtrim($base ?? (string) env('COOLIFY_API_URL'), '/'); // Use config() not env() — env() returns null when config is cached
$this->token = $token ?? (string) env('COOLIFY_API_TOKEN'); // in production. Octane workers also cache env at boot.
$this->base = rtrim($base ?? (string) config('services.coolify.url'), '/');
$this->token = $token ?? (string) config('services.coolify.token');
} }
public function isConfigured(): bool public function isConfigured(): bool
+6
View File
@@ -35,4 +35,10 @@ return [
], ],
], ],
'coolify' => [
'url' => env('COOLIFY_API_URL'),
'token' => env('COOLIFY_API_TOKEN'),
'app_uuid' => env('COOLIFY_APP_UUID'),
],
]; ];