add env vars for compose base apps
This commit is contained in:
@@ -905,6 +905,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: move this in a shared function
|
||||||
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
|
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_APP_NAME={$this->application->name}");
|
$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}");
|
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: move this in a shared function
|
||||||
if ($this->application->environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
|
if ($this->application->environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_APP_NAME={$this->application->name}");
|
$envs->push("COOLIFY_APP_NAME={$this->application->name}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1471,6 +1471,20 @@ class Application extends BaseModel
|
|||||||
if ($this->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
if ($this->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
||||||
$environment->put('COOLIFY_CONTAINER_NAME', $containerName);
|
$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
|
// Remove SERVICE_FQDN and SERVICE_URL from environment
|
||||||
$environment = $environment->filter(function ($value, $key) {
|
$environment = $environment->filter(function ($value, $key) {
|
||||||
return ! str($key)->startsWith('SERVICE_FQDN') && ! str($key)->startsWith('SERVICE_URL');
|
return ! str($key)->startsWith('SERVICE_FQDN') && ! str($key)->startsWith('SERVICE_URL');
|
||||||
|
|||||||
Reference in New Issue
Block a user