42 lines
814 B
Go
42 lines
814 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"flag"
|
||
|
"fmt"
|
||
|
|
||
|
"git.wntrmute.dev/kyle/goutils/config"
|
||
|
"git.wntrmute.dev/kyle/goutils/die"
|
||
|
"git.wntrmute.dev/kyle/goutils/log"
|
||
|
"git.wntrmute.dev/kyle/overpush/server"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
var configFile string
|
||
|
|
||
|
flag.StringVar(&configFile, "f", "", "`path` to config file")
|
||
|
flag.Parse()
|
||
|
|
||
|
if configFile != "" {
|
||
|
err := config.LoadFile(configFile)
|
||
|
die.If(err)
|
||
|
}
|
||
|
|
||
|
logLevel := config.GetDefault("log_level", "WARNING")
|
||
|
opts := log.DefaultOptions("overpush", false)
|
||
|
opts.Level = logLevel
|
||
|
|
||
|
fmt.Println("listing keys:")
|
||
|
for _, k := range config.ListKeys() {
|
||
|
fmt.Printf("\t%s\n", k)
|
||
|
}
|
||
|
|
||
|
err := log.Setup(opts)
|
||
|
die.If(err)
|
||
|
|
||
|
srv, err := server.New()
|
||
|
log.FatalError(err, "failed to set up gRPC server")
|
||
|
go srv.Default.Receive()
|
||
|
|
||
|
log.FatalError(server.Run(srv), "server has died")
|
||
|
}
|