nyx/main.go

31 lines
545 B
Go
Raw Normal View History

package main
import (
"go.rls.moe/nyx/config"
"go.rls.moe/nyx/http"
2017-03-15 14:37:37 +01:00
"log"
"os"
"time"
"flag"
)
func main() {
flag.Parse()
c, err := config.Load()
if err != nil {
2017-03-15 14:37:37 +01:00
log.Printf("Could not read configuration: %s\n", err)
return
}
2020-04-22 07:24:01 +02:00
log.Printf("Starting Server at %s\n", c.ListenOn)
2017-03-15 14:37:37 +01:00
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)
}