aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-03-11 14:33:08 +0100
committerTeddy Wing2017-03-11 14:33:08 +0100
commite6eee887588efff57d7e8b39894143880357f61c (patch)
tree812c7095cecc7a3bb3bf463d84b1bf51026fcb54
parent7010ef25c90272b81eff2f37a3ca7ac5afd53b69 (diff)
downloadtimetasker-e6eee887588efff57d7e8b39894143880357f61c.tar.bz2
main.go: Move config loading to a new function
* Extract the config loading lines from `main` so we can give them a name * Make `config` available globally
-rw-r--r--main.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/main.go b/main.go
index ba853e1..3cc1a9e 100644
--- a/main.go
+++ b/main.go
@@ -37,13 +37,17 @@ type Config struct {
}
}
+var config Config
+
func main() {
+ loadConfig()
+}
+
+func loadConfig() {
config_str, err := ioutil.ReadFile("config.yml")
- config := Config{}
+ config = Config{}
err = yaml.Unmarshal(config_str, &config)
if err != nil {
log.Println(err)
}
-
- log.Printf("%+v", config)
}