dissertation-2-code/main.go

44 lines
641 B
Go
Raw Normal View History

2020-10-22 21:19:26 +01:00
package main
import (
2020-10-25 15:36:34 +00:00
"log"
"mpbl3p/config"
2020-10-24 17:44:14 +01:00
"os"
"os/signal"
"syscall"
)
2020-10-22 21:19:26 +01:00
func main() {
2020-10-25 15:36:34 +00:00
log.SetFlags(log.Ldate | log.Ltime | log.Llongfile)
log.Println("loading config...")
2020-11-26 22:10:37 +00:00
var configLoc string
if v, ok := os.LookupEnv("CONFIG_LOC"); ok {
configLoc = v
} else {
configLoc = "config.ini"
}
c, err := config.LoadConfig(configLoc)
if err != nil {
panic(err)
}
2020-10-25 15:36:34 +00:00
log.Println("building config...")
2020-10-24 17:44:14 +01:00
p, err := c.Build()
if err != nil {
panic(err)
}
2020-10-25 15:36:34 +00:00
log.Println("starting...")
2020-10-24 17:44:14 +01:00
p.Start()
2020-10-25 15:36:34 +00:00
log.Println("running")
2020-10-24 17:44:14 +01:00
signals := make(chan os.Signal)
signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT)
<-signals
2020-10-22 21:19:26 +01:00
}