Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion loader/full-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ services:
# somehost: "162.242.195.82"
# otherhost: "50.31.209.229"
extra_hosts:
- "somehost:162.242.195.82"
- "otherhost:50.31.209.229"
- "somehost:162.242.195.82"

hostname: foo

Expand Down
12 changes: 6 additions & 6 deletions loader/full-struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@ services:
- project_db_1:mysql
- project_db_1:postgresql
extra_hosts:
otherhost: 50.31.209.229
somehost: 162.242.195.82
- otherhost:50.31.209.229
- somehost:162.242.195.82
hostname: foo
healthcheck:
test:
Expand Down Expand Up @@ -1302,10 +1302,10 @@ func fullExampleJSON(workingDir, homeDir string) string {
"project_db_1:mysql",
"project_db_1:postgresql"
],
"extra_hosts": {
"otherhost": "50.31.209.229",
"somehost": "162.242.195.82"
},
"extra_hosts": [
"otherhost:50.31.209.229",
"somehost:162.242.195.82"
],
"hostname": "foo",
"healthcheck": {
"test": [
Expand Down
12 changes: 12 additions & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,18 @@ func (h HostsList) AsList() []string {
return l
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a sort.Strings to ensure stable output?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice suggestion!

}

func (h HostsList) MarshalYAML() (interface{}, error) {
list := h.AsList()
sort.Strings(list)
return list, nil
}

func (h HostsList) MarshalJSON() ([]byte, error) {
list := h.AsList()
sort.Strings(list)
return json.Marshal(list)
}

// LoggingConfig the logging configuration for a service
type LoggingConfig struct {
Driver string `yaml:",omitempty" json:"driver,omitempty"`
Expand Down