38 lines
1003 B
Go
38 lines
1003 B
Go
package main
|
|
|
|
import (
|
|
"git.timovolkmann.de/gyrogpsc/core"
|
|
"git.timovolkmann.de/gyrogpsc/storage"
|
|
"git.timovolkmann.de/gyrogpsc/web"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func main() {
|
|
conf := &core.Configuration{}
|
|
configurationFromFile(conf)
|
|
|
|
repo := storage.NewRepository(conf)
|
|
disp := core.NewDispatcher()
|
|
|
|
service := core.TrackingService(repo, disp, conf)
|
|
|
|
web.CreateServer(service, disp, conf)
|
|
}
|
|
|
|
func configurationFromFile(c *core.Configuration) {
|
|
viper.SetDefault("TcpCollectorPort", ":3010")
|
|
viper.SetDefault("SerialCollectorPort", "/dev/tty.usbmodem14201")
|
|
viper.SetDefault("HttpPort", "layouts")
|
|
viper.SetDefault("publishIntervalMs", 50)
|
|
viper.SetDefault("syncUpdateIntervalMs", 494)
|
|
|
|
viper.SetConfigName("gpsconfig") // name of config file (without extension)
|
|
viper.SetConfigType("yaml")
|
|
viper.AddConfigPath(".")
|
|
viper.AddConfigPath("./../../")
|
|
|
|
viper.Unmarshal(c)
|
|
logrus.Println(c)
|
|
}
|