Merge pull request #4945 from nktnet1/feat-env-coolify-resource-uuid
feat(env): added COOLIFY_RESOURCE_UUID environment variable
This commit is contained in:
@@ -923,6 +923,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
|
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
|
||||||
}
|
}
|
||||||
|
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_RESOURCE_UUID')->isEmpty()) {
|
||||||
|
$envs->push("COOLIFY_RESOURCE_UUID={$this->application->uuid}");
|
||||||
|
}
|
||||||
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
||||||
}
|
}
|
||||||
@@ -982,6 +985,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->application->environment_variables->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
if ($this->application->environment_variables->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
|
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
|
||||||
}
|
}
|
||||||
|
if ($this->application->environment_variables->where('key', 'COOLIFY_RESOURCE_UUID')->isEmpty()) {
|
||||||
|
$envs->push("COOLIFY_RESOURCE_UUID={$this->application->uuid}");
|
||||||
|
}
|
||||||
if ($this->application->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
if ($this->application->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
||||||
}
|
}
|
||||||
|
@@ -2115,6 +2115,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$parsedServiceVariables->put($key, $value);
|
$parsedServiceVariables->put($key, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$parsedServiceVariables->put('COOLIFY_RESOURCE_UUID', "{$resource->uuid}");
|
||||||
$parsedServiceVariables->put('COOLIFY_CONTAINER_NAME', "$serviceName-{$resource->uuid}");
|
$parsedServiceVariables->put('COOLIFY_CONTAINER_NAME', "$serviceName-{$resource->uuid}");
|
||||||
|
|
||||||
// TODO: move this in a shared function
|
// TODO: move this in a shared function
|
||||||
@@ -3606,6 +3607,11 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add COOLIFY_RESOURCE_UUID to environment
|
||||||
|
if ($resource->environment_variables->where('key', 'COOLIFY_RESOURCE_UUID')->isEmpty()) {
|
||||||
|
$coolifyEnvironments->put('COOLIFY_RESOURCE_UUID', "{$resource->uuid}");
|
||||||
|
}
|
||||||
|
|
||||||
// Add COOLIFY_CONTAINER_NAME to environment
|
// Add COOLIFY_CONTAINER_NAME to environment
|
||||||
if ($resource->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
if ($resource->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
||||||
$coolifyEnvironments->put('COOLIFY_CONTAINER_NAME', "{$containerName}");
|
$coolifyEnvironments->put('COOLIFY_CONTAINER_NAME', "{$containerName}");
|
||||||
|
Reference in New Issue
Block a user