diff options
author | Dan Duvall <dduvall@wikimedia.org> | 2017-04-25 16:29:58 -0700 |
---|---|---|
committer | Dan Duvall <dduvall@wikimedia.org> | 2017-04-25 16:29:58 -0700 |
commit | 72a866a74aade72fd9b22a6f364a68193087e8f3 (patch) | |
tree | 35c33df8b389cffe917bd9bb86122f114dc448a0 /config | |
parent | b993d5c7398fd5bba968d400d5731df7d321a557 (diff) | |
download | blubber-72a866a74aade72fd9b22a6f364a68193087e8f3.tar.gz |
Use a YAML config format instead of JSON
Diffstat (limited to 'config')
-rw-r--r-- | config/apt.go | 2 | ||||
-rw-r--r-- | config/artifacts.go | 6 | ||||
-rw-r--r-- | config/common.go | 12 | ||||
-rw-r--r-- | config/config.go | 4 | ||||
-rw-r--r-- | config/npm.go | 4 | ||||
-rw-r--r-- | config/reader.go | 4 | ||||
-rw-r--r-- | config/run.go | 8 | ||||
-rw-r--r-- | config/variant.go | 6 |
8 files changed, 23 insertions, 23 deletions
diff --git a/config/apt.go b/config/apt.go index e6ad22c..f9e631f 100644 --- a/config/apt.go +++ b/config/apt.go @@ -6,7 +6,7 @@ import ( ) type AptConfig struct { - Packages []string `json:packages` + Packages []string `yaml:"packages"` } func (apt *AptConfig) Merge(apt2 AptConfig) { diff --git a/config/artifacts.go b/config/artifacts.go index 78b6276..fd7b741 100644 --- a/config/artifacts.go +++ b/config/artifacts.go @@ -1,7 +1,7 @@ package config type ArtifactsConfig struct { - From string `json:from` - Source string `json:source` - Destination string `json:destination` + From string `yaml:"from"` + Source string `yaml:"source"` + Destination string `yaml:"destination"` } diff --git a/config/common.go b/config/common.go index 492171e..36ebc01 100644 --- a/config/common.go +++ b/config/common.go @@ -1,12 +1,12 @@ package config type CommonConfig struct { - Base string `json:base` - Apt AptConfig `json:apt` - Npm NpmConfig `json:npm` - Run RunConfig `json:run` - SharedVolume bool `json:sharedvolume` - EntryPoint []string `json:entrypoint` + Base string `yaml:"base"` + Apt AptConfig `yaml:"apt"` + Npm NpmConfig `yaml:"npm"` + Run RunConfig `yaml:"run"` + SharedVolume bool `yaml:"sharedvolume"` + EntryPoint []string `yaml:"entrypoint"` } func (cc1 *CommonConfig) Merge(cc2 CommonConfig) { diff --git a/config/config.go b/config/config.go index 36eb6e4..dcf1adb 100644 --- a/config/config.go +++ b/config/config.go @@ -1,8 +1,8 @@ package config type Config struct { - CommonConfig - Variants map[string]VariantConfig `json:variants` + CommonConfig `yaml:",inline"` + Variants map[string]VariantConfig `yaml:"variants"` } type CommandCompileable interface { diff --git a/config/npm.go b/config/npm.go index 250607e..c4a52c1 100644 --- a/config/npm.go +++ b/config/npm.go @@ -5,8 +5,8 @@ import ( ) type NpmConfig struct { - Install bool `json:install` - Env string `json:env` + Install bool `yaml:"install"` + Env string `yaml:"env"` } func (npm *NpmConfig) Merge(npm2 NpmConfig) { diff --git a/config/reader.go b/config/reader.go index f63a4c9..478a312 100644 --- a/config/reader.go +++ b/config/reader.go @@ -3,7 +3,7 @@ package config import ( "errors" "io/ioutil" - "encoding/json" + "gopkg.in/yaml.v2" ) func ExpandVariant(config *Config, name string) (*VariantConfig, error) { @@ -29,7 +29,7 @@ func ExpandVariant(config *Config, name string) (*VariantConfig, error) { func ReadConfig(data []byte) (*Config, error) { var config Config - err := json.Unmarshal(data, &config) + err := yaml.Unmarshal(data, &config) return &config, err } diff --git a/config/run.go b/config/run.go index c3ffd08..410eca6 100644 --- a/config/run.go +++ b/config/run.go @@ -6,10 +6,10 @@ import ( ) type RunConfig struct { - In string `json:in` - As string `json:as` - Uid int `json:uid` - Gid int `json:gid` + In string `yaml:"in"` + As string `yaml:"as"` + Uid int `yaml:"uid"` + Gid int `yaml:"uid"` } func (run *RunConfig) Merge(run2 RunConfig) { diff --git a/config/variant.go b/config/variant.go index d1640bb..808db72 100644 --- a/config/variant.go +++ b/config/variant.go @@ -1,9 +1,9 @@ package config type VariantConfig struct { - Includes []string `json:includes` - Artifacts []ArtifactsConfig `json:artifacts` - CommonConfig + Includes []string `yaml:"includes"` + Artifacts []ArtifactsConfig `yaml:"artifacts"` + CommonConfig `yaml:",inline"` } func (vc1 *VariantConfig) Merge(vc2 VariantConfig) { |