mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
feat(deployments): generate SERVICE_NAME environment variables from Docker Compose services
- Added functionality to generate environment variables for each service defined in the Docker Compose file, transforming service names into uppercase and replacing special characters. - Updated the service parser to merge these generated variables with existing environment variables, enhancing deployment configuration.
This commit is contained in:
@@ -1172,6 +1172,9 @@ function serviceParser(Service $resource): Collection
|
||||
|
||||
$parsedServices = collect([]);
|
||||
|
||||
// Generate SERVICE_NAME variables for docker compose services
|
||||
$serviceNameEnvironments = generateDockerComposeServiceName($services);
|
||||
|
||||
$allMagicEnvironments = collect([]);
|
||||
// Presave services
|
||||
foreach ($services as $serviceName => $service) {
|
||||
@@ -1988,7 +1991,7 @@ function serviceParser(Service $resource): Collection
|
||||
$payload['volumes'] = $volumesParsed;
|
||||
}
|
||||
if ($environment->count() > 0 || $coolifyEnvironments->count() > 0) {
|
||||
$payload['environment'] = $environment->merge($coolifyEnvironments);
|
||||
$payload['environment'] = $environment->merge($coolifyEnvironments)->merge($serviceNameEnvironments);
|
||||
}
|
||||
if ($logging) {
|
||||
$payload['logging'] = $logging;
|
||||
|
||||
Reference in New Issue
Block a user