Change the way domains and hostnames are configured

This commit is contained in:
Mike Cheng 2015-05-04 03:07:14 -04:00
parent 338c337736
commit 9faf101631
3 changed files with 21 additions and 16 deletions

View file

@ -6,11 +6,12 @@ import (
)
type Config struct {
Dev bool `json:"dev"`
Domains []string `json:"domains"`
Interval int `json:"interval"`
Token string `json:"token"`
Username string `json:"username"`
Dev bool `json:"dev"`
Domain string `json:"domain"`
Hostnames []string `json:"hostnames"`
Interval int `json:"interval"`
Token string `json:"token"`
Username string `json:"username"`
}
func LoadConfigs(path string) ([]Config, error) {

View file

@ -10,17 +10,19 @@ var expectedConfigs []Config
func init() {
expectedConfigs = []Config{
Config{
Username: "dev-account",
Token: "asdasdasdasdasdad",
Interval: 60,
Dev: true,
Domains: []string{"test.com", "fake.com"},
Username: "dev-account",
Token: "asdasdasdasdasdad",
Interval: 60,
Dev: true,
Domain: "test.com",
Hostnames: []string{"mail", "chat"},
},
Config{
Username: "production-account",
Token: "123123123123",
Interval: 3600,
Domains: []string{"live.com", "abc.live.com"},
Username: "production-account",
Token: "123123123123",
Interval: 3600,
Domain: "live.com",
Hostnames: []string{"mail", "support"},
},
}
}

View file

@ -5,13 +5,15 @@
"token": "asdasdasdasdasdad",
"interval": 60,
"dev": true,
"domains": [ "test.com", "fake.com" ]
"domain": "test.com",
"hostnames": [ "mail", "chat" ]
},
{
"username": "production-account",
"token": "123123123123",
"interval": 3600,
"domains": [ "live.com", "abc.live.com" ]
"domain": "live.com",
"hostnames": [ "mail", "support" ]
}
]
}