Skip to content

Commit 35c575c

Browse files
akerouantonndeloof
authored andcommitted
networks.enable_ipv6: make it optional
This field isn't marked as required in the compose-spec, but it's implemented as a basic `bool` in this package. This means it automatically defaults to `false` when not specified. A recent change was made to Docker Engine to allow users to define a daemon-wide default value for the equivalent API field. Without this change, Compose would always send a value to the Engine API, preventing it from defining its own default value. See moby/moby#47867. Signed-off-by: Albin Kerouanton <[email protected]>
1 parent 27c7848 commit 35c575c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

loader/loader_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,7 @@ networks:
16891689

16901690
workingDir, err := os.Getwd()
16911691
assert.NilError(t, err)
1692+
enableIPv6 := true
16921693
expected := &types.Project{
16931694
Name: "load-network-link-local-ips",
16941695
WorkingDir: workingDir,
@@ -1711,7 +1712,7 @@ networks:
17111712
"network1": {
17121713
Name: "network1",
17131714
Driver: "bridge",
1714-
EnableIPv6: true,
1715+
EnableIPv6: &enableIPv6,
17151716
Ipam: types.IPAMConfig{
17161717
Config: []*types.IPAMPool{
17171718
{Subnet: "10.1.0.0/16"},

types/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ type NetworkConfig struct {
698698
Internal bool `yaml:"internal,omitempty" json:"internal,omitempty"`
699699
Attachable bool `yaml:"attachable,omitempty" json:"attachable,omitempty"`
700700
Labels Labels `yaml:"labels,omitempty" json:"labels,omitempty"`
701-
EnableIPv6 bool `yaml:"enable_ipv6,omitempty" json:"enable_ipv6,omitempty"`
701+
EnableIPv6 *bool `yaml:"enable_ipv6,omitempty" json:"enable_ipv6,omitempty"`
702702
Extensions Extensions `yaml:"#extensions,inline,omitempty" json:"-"`
703703
}
704704

0 commit comments

Comments
 (0)