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 { type Config struct {
Dev bool `json:"dev"` Dev bool `json:"dev"`
Domains []string `json:"domains"` Domain string `json:"domain"`
Interval int `json:"interval"` Hostnames []string `json:"hostnames"`
Token string `json:"token"` Interval int `json:"interval"`
Username string `json:"username"` Token string `json:"token"`
Username string `json:"username"`
} }
func LoadConfigs(path string) ([]Config, error) { func LoadConfigs(path string) ([]Config, error) {

View file

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

View file

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