diff --git a/common/config.go b/common/config.go index 7b5cb8d..f2d8827 100644 --- a/common/config.go +++ b/common/config.go @@ -34,6 +34,13 @@ type Config struct { Org string } +// Version carries around the API version information +type Version struct { + Version string + BuildStamp string + GitHash string +} + // Account is the configuration for an individual account type Account struct { LTMHost string @@ -42,12 +49,14 @@ type Account struct { Password string } +/* // Version carries around the API version information type Version struct { Version string BuildStamp string GitHash string } +*/ // ReadConfig decodes the configuration from an io Reader func ReadConfig(r io.Reader) (Config, error) { diff --git a/common/config_test.go b/common/config_test.go index 91f4e55..006b457 100644 --- a/common/config_test.go +++ b/common/config_test.go @@ -25,15 +25,16 @@ import ( var testConfig = []byte( `{ "listenAddress": ":8000", - "account": { - "region": "us-east-1", - "akid": "key1", - "secret": "secret1", - "role": "uber-role", - "externalId": "foobar" + "accounts": { + "www.example.org": { + "ltmhost": "www.example.org", + "username": "user1", + "password": "1badpass", + "uploadpath": "/foobar" + } }, "token": "SEKRET", - "logLevel": "info", + "logLevel": "infos", "org": "test" }`) @@ -42,16 +43,17 @@ var brokenConfig = []byte(`{ "foobar": { "baz": "biz" }`) func TestReadConfig(t *testing.T) { expectedConfig := Config{ ListenAddress: ":8000", - Account: Account{ - Region: "us-east-1", - Akid: "key1", - Secret: "secret1", - Role: "uber-role", - ExternalID: "foobar", + Token: "SEKRET", + LogLevel: "infos", + Org: "test", + Accounts: map[string]Account{ + "www.example.org": Account{ + LTMHost: "www.example.org", + Username: "user1", + Password: "1badpass", + UploadPath: "/foobar", + }, }, - Token: "SEKRET", - LogLevel: "info", - Org: "test", } actualConfig, err := ReadConfig(bytes.NewReader(testConfig)) diff --git a/docker/import_config.sh b/docker/import_config.sh old mode 100644 new mode 100755