44 lines
641 B
Go
44 lines
641 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"mpbl3p/config"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
func main() {
|
|
log.SetFlags(log.Ldate | log.Ltime | log.Llongfile)
|
|
|
|
log.Println("loading config...")
|
|
|
|
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)
|
|
}
|
|
|
|
log.Println("building config...")
|
|
p, err := c.Build()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
log.Println("starting...")
|
|
p.Start()
|
|
|
|
log.Println("running")
|
|
|
|
signals := make(chan os.Signal)
|
|
signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT)
|
|
|
|
<-signals
|
|
}
|