diff --git a/app/Services/CompanyProvisioner.php b/app/Services/CompanyProvisioner.php index bff0966..c46b63c 100644 --- a/app/Services/CompanyProvisioner.php +++ b/app/Services/CompanyProvisioner.php @@ -83,8 +83,8 @@ class CompanyProvisioner // Add subdomain to Coolify FQDN list + trigger redeploy. $deployTriggered = false; - if ($this->coolify->isConfigured() && env('COOLIFY_APP_UUID')) { - $appUuid = (string) env('COOLIFY_APP_UUID'); + $appUuid = (string) config('services.coolify.app_uuid'); + if ($this->coolify->isConfigured() && $appUuid !== '') { $url = $company->url(''); $url = rtrim($url, '/') . ':8000'; // internal port suffix Coolify expects if ($this->coolify->addDomain($appUuid, $url)) { diff --git a/app/Services/CoolifyClient.php b/app/Services/CoolifyClient.php index a9c5153..0e2a75a 100644 --- a/app/Services/CoolifyClient.php +++ b/app/Services/CoolifyClient.php @@ -20,8 +20,10 @@ class CoolifyClient protected ?string $base = null, protected ?string $token = null, ) { - $this->base = rtrim($base ?? (string) env('COOLIFY_API_URL'), '/'); - $this->token = $token ?? (string) env('COOLIFY_API_TOKEN'); + // Use config() not env() — env() returns null when config is cached + // 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 diff --git a/config/services.php b/config/services.php index 6a90eb8..e0fc479 100644 --- a/config/services.php +++ b/config/services.php @@ -35,4 +35,10 @@ return [ ], ], + 'coolify' => [ + 'url' => env('COOLIFY_API_URL'), + 'token' => env('COOLIFY_API_TOKEN'), + 'app_uuid' => env('COOLIFY_APP_UUID'), + ], + ];