refactor: Update dockerComposeParser to use YAML data from $yaml instead of $compose

This commit is contained in:
Andras Bacsai
2024-08-23 14:31:16 +02:00
parent af1b479d73
commit 6fbdfee3e7
2 changed files with 12 additions and 7 deletions

View File

@@ -1100,10 +1100,10 @@ class Application extends BaseModel
} }
$services = data_get($yaml, 'services', collect([])); $services = data_get($yaml, 'services', collect([]));
$topLevel = collect([ $topLevel = collect([
'volumes' => collect(data_get($compose, 'volumes', [])), 'volumes' => collect(data_get($yaml, 'volumes', [])),
'networks' => collect(data_get($compose, 'networks', [])), 'networks' => collect(data_get($yaml, 'networks', [])),
'configs' => collect(data_get($compose, 'configs', [])), 'configs' => collect(data_get($yaml, 'configs', [])),
'secrets' => collect(data_get($compose, 'secrets', [])), 'secrets' => collect(data_get($yaml, 'secrets', [])),
]); ]);
// If there are predefined volumes, make sure they are not null // If there are predefined volumes, make sure they are not null
@@ -1475,7 +1475,6 @@ class Application extends BaseModel
$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');
}); });
ray($environment);
// Labels // Labels
$fqdns = collect([]); $fqdns = collect([]);

View File

@@ -54,7 +54,12 @@ beforeEach(function () {
], ],
'networks' => [ 'networks' => [
'default' => [ 'default' => [
'ipv4_address' => '127.0.0.1', 'name' => 'something',
'external' => true,
],
'noinet' => [
'driver' => 'bridge',
'internal' => true,
], ],
], ],
]; ];
@@ -91,7 +96,8 @@ test('ComposeParse', function () {
expect($output)->toBeInstanceOf(Collection::class); expect($output)->toBeInstanceOf(Collection::class);
expect($outputOld)->toBeInstanceOf(Collection::class); expect($outputOld)->toBeInstanceOf(Collection::class);
ray(Yaml::dump($output->toArray(), 10, 2)); // ray(Yaml::dump($output->toArray(), 10, 2));
ray(Yaml::dump($outputOld->toArray(), 10, 2));
}); });