Fixed config parsing
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9d7710b376
commit
8bc760905f
|
@ -7,6 +7,6 @@ Mode = 1
|
|||
|
||||
; Serverkram
|
||||
; Das Interface inkl. Port, auf dem der Webserver läuft. Muss komplett mit IP-Adresse vorhanden sein.
|
||||
Interface = 127.0.0.1:8080
|
||||
Interface = :8080
|
||||
; Hier wird die Datenbank gespeichert
|
||||
DBFile = ./data.db
|
21
main.go
21
main.go
|
@ -1,15 +1,17 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/config"
|
||||
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/models"
|
||||
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/router"
|
||||
"github.com/astaxie/session"
|
||||
_ "github.com/astaxie/session/providers/memory"
|
||||
"github.com/asticode/go-astilectron"
|
||||
"github.com/asticode/go-astilog"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/labstack/gommon/log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
)
|
||||
|
||||
//Initialize Session
|
||||
|
@ -56,6 +58,7 @@ func main() {
|
|||
//Echo init
|
||||
e := router.NewEcho()
|
||||
router.RegisterRoutes(e)
|
||||
|
||||
// Start server
|
||||
go func() {
|
||||
fmt.Println(config.GetConfig())
|
||||
|
@ -64,6 +67,18 @@ func main() {
|
|||
}
|
||||
}()
|
||||
|
||||
// Wait for interrupt signal to gracefully shutdown the server with
|
||||
// a timeout of 10 seconds.
|
||||
quit := make(chan os.Signal, 1)
|
||||
signal.Notify(quit, os.Interrupt)
|
||||
<-quit
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
log.Infof("Shutting down...")
|
||||
if err := e.Shutdown(ctx); err != nil {
|
||||
e.Logger.Fatal(err)
|
||||
}
|
||||
|
||||
// TODO: Make sure everything still works
|
||||
// TODO: Distribute as single binary
|
||||
// TODO: Switch to viper
|
||||
|
|
|
@ -16,8 +16,7 @@ type Configuration struct {
|
|||
var siteConf = &Configuration{}
|
||||
|
||||
func InitConfig() {
|
||||
siteConf := new(Configuration)
|
||||
err := ini.MapTo(siteConf, "config.ini")
|
||||
err := ini.MapTo(siteConf, "./config.ini")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue