diff --git a/dotyaml.go b/dotyaml.go index 4e0f7a9..47185a5 100644 --- a/dotyaml.go +++ b/dotyaml.go @@ -39,6 +39,7 @@ type Services struct { Init string `yaml:"init,omitempty"` Ipc string `yaml:"ipc,omitempty"` Labels interface{} `yaml:"labels,omitempty"` + Logging ServicesLogging `yaml:"logging,omitempty"` MacAddress string `yaml:"mac_address,omitempty"` MemLimit string `yaml:"mem_limit,omitempty"` MemReservation string `yaml:"mem_reservation,omitempty"` @@ -68,6 +69,11 @@ type Services struct { WorkingDir string `yaml:"working_dir,omitempty"` } +type ServicesLogging struct { + Driver string `yaml:"driver,omitempty"` + Options interface{} `yaml:"options,omitempty"` +} + type ServicesBlockIO struct { Weight int16 `yaml:"weight,omitempty"` WeightDevice []ServicesBlockIOWeightDevice `yaml:"weight_device,omitempty"` diff --git a/main.go b/main.go index 8c716e0..2ab4e69 100644 --- a/main.go +++ b/main.go @@ -268,7 +268,7 @@ func buildCommand(e *Yaml, l []EnvironmentVariable) Command { } } - if v.Healthcheck.Test != "" { + if v.Healthcheck.Test != nil { p := normalizeValue(v.Healthcheck.Test) arr = append(arr, "--health-cmd", "'"+convertToString(p)+"'") } @@ -301,6 +301,18 @@ func buildCommand(e *Yaml, l []EnvironmentVariable) Command { arr = append(arr, "--ipc", v.Ipc) } + if v.Logging.Driver != "" { + arr = append(arr, "--log-driver", v.Logging.Driver) + } + + if v.Logging.Options != nil { + for _, r := range normalizeValue(v.Logging.Options) { + p := transformPairs(r) + arr = append(arr, "--log-opt", p.Key) + fmt.Println(p.Key) + } + } + if v.MacAddress != "" { arr = append(arr, "--mac-address", v.MacAddress) }