0
0
mirror of https://github.com/rls-moe/nyx synced 2024-11-13 22:12:24 +00:00
nyx/main.go
2020-04-22 07:24:01 +02:00

31 lines
545 B
Go

package main
import (
"go.rls.moe/nyx/config"
"go.rls.moe/nyx/http"
"log"
"os"
"time"
"flag"
)
func main() {
flag.Parse()
c, err := config.Load()
if err != nil {
log.Printf("Could not read configuration: %s\n", err)
return
}
log.Printf("Starting Server at %s\n", c.ListenOn)
if err := http.Start(c); err != nil {
log.Printf("Could not start server or server crashed: %s\n", err)
log.Printf("Waiting 10 seconds before dying...")
time.Sleep(10 * time.Second)
log.Printf("Exiting")
os.Exit(1)
return
}
os.Exit(0)
}