make extra_hosts values uniques#685
Conversation
override/uncity.go
Outdated
| unique["services.*.environment"] = keyValueIndexer | ||
| unique["services.*.env_file"] = envFileIndexer | ||
| unique["services.*.expose"] = exposeIndexer | ||
| unique["services.*.extra_hosts"] = keyValueIndexer |
There was a problem hiding this comment.
:-1
this was intentionally removed, as extra_hosts can be set multiple time per host with distinct IPs
see docker/compose#12088
There was a problem hiding this comment.
one option could be to drop strictly equal lines, which somehow relax the json schema unicity rule, which doesn't bring any value here
There was a problem hiding this comment.
Ok, I'll build a custom indexer
38f94a7 to
6523dd3
Compare
| // Rewrite content of left slice to remove duplicate elements | ||
| i := 0 | ||
| for _, v := range left { | ||
| if !slices.Contains(right, v) { | ||
| left[i] = v | ||
| i++ | ||
| } | ||
| } | ||
| // keep only not duplicated elements from left slice | ||
| left = left[:i] |
There was a problem hiding this comment.
you can use https://pkg.go.dev/slices#Compact to remove duplicates from a slice
There was a problem hiding this comment.
Nope I tried it and it works only with consecutive values unfortunately
6523dd3 to
8231c19
Compare
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
8231c19 to
602e5ba
Compare
|
Thanks for the bugfix! Is there an estimated date for a new release? 😅 |
|
@Nek- We are not sure, but should be around in 1~2 weeks |
Issue occurred when you have an
extra_hostsvalue defined in the main config file and you have anextendsof the service with the exact same name without any additionalextra_hostsconfigFixes docker/compose#12155