ss13_se/main.go
A. Svensson d2af505b0c Add TOML config and clean up startup.
- Removed servers.json and it's config code.
- Load the new config.toml, using TOML instead of JSON.
- Moved most of the cli flags to the config file.
- Simplified creation of a new server instance (using New()).
- Goroutine running updates was moved inside the lib.
2016-06-19 15:31:38 +02:00

38 lines
592 B
Go

package main
import (
"flag"
"log"
"github.com/lmas/ss13_se/src"
)
var (
fConfig = flag.String("config", "config.toml", "path to config file")
fDebug = flag.Bool("debug", false, "run in debug mode")
)
func main() {
flag.Parse()
ins, e := ss13.New(*fDebug, *fConfig)
CheckError(e)
if *fDebug {
Log("Updating servers every %d minutes", ins.Config.UpdateEvery)
Log("Listening on %s", ins.Config.ListenAddr)
}
e = ins.Run()
CheckError(e)
}
func Log(f string, args ...interface{}) {
log.Printf(f+"\n", args...)
}
func CheckError(e error) {
if e != nil {
panic(e)
}
}