fix: check env in args for compose based apps
This commit is contained in:
parent
ab039adf97
commit
7723c623d5
@ -90,6 +90,7 @@ class EnvironmentVariable extends Model
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$found_in_compose = false;
|
$found_in_compose = false;
|
||||||
|
$found_in_args = false;
|
||||||
$resource = $this->resource();
|
$resource = $this->resource();
|
||||||
$compose = data_get($resource, 'docker_compose_raw');
|
$compose = data_get($resource, 'docker_compose_raw');
|
||||||
if (!$compose) {
|
if (!$compose) {
|
||||||
@ -102,21 +103,35 @@ class EnvironmentVariable extends Model
|
|||||||
}
|
}
|
||||||
foreach ($services as $service) {
|
foreach ($services as $service) {
|
||||||
$environments = collect(data_get($service, 'environment'));
|
$environments = collect(data_get($service, 'environment'));
|
||||||
if ($environments->isEmpty()) {
|
$args = collect(data_get($service, 'build.args'));
|
||||||
|
if ($environments->isEmpty() && $args->isEmpty()) {
|
||||||
$found_in_compose = false;
|
$found_in_compose = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$found_in_compose = $environments->contains(function ($item) {
|
$found_in_compose = $environments->contains(function ($item) {
|
||||||
if (str($item)->contains('=')) {
|
if (str($item)->contains('=')) {
|
||||||
$item = str($item)->before('=');
|
$item = str($item)->before('=');
|
||||||
}
|
}
|
||||||
return strpos($item, $this->key) !== false;
|
return strpos($item, $this->key) !== false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($found_in_compose) {
|
if ($found_in_compose) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$found_in_args = $args->contains(function ($item) {
|
||||||
|
if (str($item)->contains('=')) {
|
||||||
|
$item = str($item)->before('=');
|
||||||
|
}
|
||||||
|
return strpos($item, $this->key) !== false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($found_in_args) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $found_in_compose;
|
return $found_in_compose || $found_in_args;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user