0
0
mirror of https://github.com/rls-moe/nyx synced 2024-11-13 22:12:24 +00:00
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 13:37:37 +00:00
"log"
"os"
"time"
"flag"
)
func main() {
flag.Parse()
c, err := config.Load()
if err != nil {
2017-03-15 13:37:37 +00:00
log.Printf("Could not read configuration: %s\n", err)
return
}
2020-04-22 05:24:01 +00:00
log.Printf("Starting Server at %s\n", c.ListenOn)
2017-03-15 13:37:37 +00: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)
}