2017-03-12 19:37:53 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.rls.moe/nyx/config"
|
|
|
|
"go.rls.moe/nyx/http"
|
2017-03-15 13:37:37 +00:00
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"time"
|
2017-03-16 11:25:25 +00:00
|
|
|
"flag"
|
2017-03-12 19:37:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2017-03-16 11:25:25 +00:00
|
|
|
flag.Parse()
|
2017-03-12 19:37:53 +00:00
|
|
|
c, err := config.Load()
|
|
|
|
if err != nil {
|
2017-03-15 13:37:37 +00:00
|
|
|
log.Printf("Could not read configuration: %s\n", err)
|
2017-03-12 19:37:53 +00:00
|
|
|
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)
|
2017-03-12 19:37:53 +00:00
|
|
|
}
|