0
0
mirror of https://github.com/rls-moe/nyx synced 2024-11-22 22:12:24 +00:00

Last minute touch-ups

This commit is contained in:
Tim Schuster 2017-03-15 14:37:37 +01:00
parent 5d39718763
commit bc23a66bb0
No known key found for this signature in database
GPG Key ID: F9E27097EFB77F61
4 changed files with 17 additions and 5 deletions

View File

@ -35,6 +35,7 @@ func LoadTemplates() error {
if err != nil { if err != nil {
panic(err) panic(err)
} }
return nil
} }
// Router sets up the Administration Panel // Router sets up the Administration Panel

View File

@ -69,6 +69,7 @@ func LoadTemplates() error {
if err != nil { if err != nil {
return err return err
} }
return nil
} }
func Router(r chi.Router) { func Router(r chi.Router) {

View File

@ -77,5 +77,5 @@ func Start(config *config.Config) error {
Addr: config.ListenOn, Addr: config.ListenOn,
MaxHeaderBytes: 1 * 1024 * 1024, MaxHeaderBytes: 1 * 1024 * 1024,
} }
srv.ListenAndServe() return srv.ListenAndServe()
} }

18
main.go
View File

@ -1,18 +1,28 @@
package main package main
import ( import (
"fmt"
"go.rls.moe/nyx/config" "go.rls.moe/nyx/config"
"go.rls.moe/nyx/http" "go.rls.moe/nyx/http"
"log"
"os"
"time"
) )
func main() { func main() {
c, err := config.Load() c, err := config.Load()
if err != nil { if err != nil {
fmt.Printf("Could not read configuration: %s\n", err) log.Printf("Could not read configuration: %s\n", err)
return return
} }
fmt.Println("Starting Server") log.Println("Starting Server")
http.Start(c) 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)
} }