An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
add env vars for compose base apps
Vahor7103dccc7281
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex fe22292d42..ce798c715a 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -905,6 +905,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");}}++ // TODO: move this in a shared functionif ($this->application->environment_variables_preview->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {$envs->push("COOLIFY_APP_NAME={$this->application->name}");}@@ -966,6 +968,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");}}++ // TODO: move this in a shared functionif ($this->application->environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {$envs->push("COOLIFY_APP_NAME={$this->application->name}");}diff --git a/app/Models/Application.php b/app/Models/Application.phpindex bb4dcdd0ec..c788dd9982 100644--- a/app/Models/Application.php+++ b/app/Models/Application.php@@ -1471,6 +1471,20 @@ class Application extends BaseModelif ($this->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {$environment->put('COOLIFY_CONTAINER_NAME', $containerName);}+ // TODO: move this in a shared function+ if ($this->environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {+ $environment->push("COOLIFY_APP_NAME={$this->database->name}");+ }+ if ($this->environment->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {+ $environment->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");+ }+ if ($this->environment->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {+ $environment->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");+ }+ if ($this->environment->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {+ $environment->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");+ }+// Remove SERVICE_FQDN and SERVICE_URL from environment$environment = $environment->filter(function ($value, $key) {return ! str($key)->startsWith('SERVICE_FQDN') && ! str($key)->startsWith('SERVICE_URL');