From 267c89fe42050d056b8c041ee66008e304c0bcf3 Mon Sep 17 00:00:00 2001 From: Nathan Lasseter Date: Sat, 26 Sep 2015 13:12:37 +0100 Subject: Config now read from file at startup --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index dd3935e..225d022 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,21 @@ package main import ( + "fmt" "log" "net/http" + "os" ) +var config Config + func main() { + var err error + config, err = LoadFile("config.json") + if err != nil { + fmt.Fprintln(os.Stderr, "Error loading config") + os.Exit(1) + } router := NewRouter() log.Fatal(http.ListenAndServe(config.Server.Listen+":"+config.Server.Port, router)) } -- cgit v1.2.1