From 9faf101631ce15960e860d1bf809953f122fca63 Mon Sep 17 00:00:00 2001 From: Mike Cheng Date: Mon, 4 May 2015 03:07:14 -0400 Subject: [PATCH] Change the way domains and hostnames are configured --- api/config.go | 11 ++++++----- api/config_test.go | 20 +++++++++++--------- api/config_test.json | 6 ++++-- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/api/config.go b/api/config.go index dff73e9..37fcd07 100644 --- a/api/config.go +++ b/api/config.go @@ -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) { diff --git a/api/config_test.go b/api/config_test.go index 0495a13..eac3a28 100644 --- a/api/config_test.go +++ b/api/config_test.go @@ -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"}, }, } } diff --git a/api/config_test.json b/api/config_test.json index 298283a..7a4a2c5 100644 --- a/api/config_test.json +++ b/api/config_test.json @@ -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" ] } ] }