fix(domain): iterate when merging over custom configs

The normal dcmerge did not work, as the check and addition was only
possible if at least one attribute such as service, network or volume
was presentThe normal dcmerge did not work, as the check and addition
was only possible if at least one attribute such as service, network or
volume was present.

The logic was adjusted.

The logic was adjusted.
This commit is contained in:
Markus Pesch 2023-11-25 18:18:08 +01:00
parent 3d97ee0ab8
commit 5dea30fec0
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -66,25 +66,25 @@ func (c *Config) ExistsVolume(name string) bool {
// Merge adds only a missing network, secret, service and volume. // Merge adds only a missing network, secret, service and volume.
func (c *Config) Merge(config *Config) { func (c *Config) Merge(config *Config) {
for name, network := range c.Networks { for name, network := range config.Networks {
if !c.ExistsNetwork(name) { if !c.ExistsNetwork(name) {
c.Networks[name] = network c.Networks[name] = network
} }
} }
for name, secret := range c.Secrets { for name, secret := range config.Secrets {
if !c.ExistsSecret(name) { if !c.ExistsSecret(name) {
c.Secrets[name] = secret c.Secrets[name] = secret
} }
} }
for name, service := range c.Services { for name, service := range config.Services {
if !c.ExistsService(name) { if !c.ExistsService(name) {
c.Services[name] = service c.Services[name] = service
} }
} }
for name, volume := range c.Volumes { for name, volume := range config.Volumes {
if !c.ExistsVolume(name) { if !c.ExistsVolume(name) {
c.Volumes[name] = volume c.Volumes[name] = volume
} }