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
|
; Serverkram
|
||||||
; Das Interface inkl. Port, auf dem der Webserver läuft. Muss komplett mit IP-Adresse vorhanden sein.
|
; 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
|
; Hier wird die Datenbank gespeichert
|
||||||
DBFile = ./data.db
|
DBFile = ./data.db
|
21
main.go
21
main.go
|
@ -1,15 +1,17 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/config"
|
"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/models"
|
||||||
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/router"
|
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/router"
|
||||||
"github.com/astaxie/session"
|
"github.com/astaxie/session"
|
||||||
_ "github.com/astaxie/session/providers/memory"
|
_ "github.com/astaxie/session/providers/memory"
|
||||||
"github.com/asticode/go-astilectron"
|
"github.com/labstack/gommon/log"
|
||||||
"github.com/asticode/go-astilog"
|
"os"
|
||||||
"github.com/pkg/errors"
|
"os/signal"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
//Initialize Session
|
//Initialize Session
|
||||||
|
@ -56,6 +58,7 @@ func main() {
|
||||||
//Echo init
|
//Echo init
|
||||||
e := router.NewEcho()
|
e := router.NewEcho()
|
||||||
router.RegisterRoutes(e)
|
router.RegisterRoutes(e)
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
go func() {
|
go func() {
|
||||||
fmt.Println(config.GetConfig())
|
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: Make sure everything still works
|
||||||
// TODO: Distribute as single binary
|
// TODO: Distribute as single binary
|
||||||
// TODO: Switch to viper
|
// TODO: Switch to viper
|
||||||
|
|
|
@ -16,8 +16,7 @@ type Configuration struct {
|
||||||
var siteConf = &Configuration{}
|
var siteConf = &Configuration{}
|
||||||
|
|
||||||
func InitConfig() {
|
func InitConfig() {
|
||||||
siteConf := new(Configuration)
|
err := ini.MapTo(siteConf, "./config.ini")
|
||||||
err := ini.MapTo(siteConf, "config.ini")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue