lobby2/cli/config.go
Adam Štrauch f7acde85c0
All checks were successful
Tests / test (push) Successful in 11s
node.json path instead of dir
2024-12-09 02:00:38 +01:00

28 lines
645 B
Go

package main
import (
"log"
"github.com/kelseyhightower/envconfig"
)
type Config struct {
APIListen string `envconfig:"LISTEN" default:"0.0.0.0:1352"`
APIToken string `envconfig:"TOKEN" default:""`
DumpPath string `envconfig:"DUMP_PATH" default:"/var/lib/lobby2/nodes.json"`
ConfigPath string `envconfig:"CONFIG_PATH" default:"/etc/lobby2/config.json"`
NodePath string `envconfig:"NODE_PATH" default:"/etc/lobby2/node.json"`
DropAfterSeconds int64 `envconfig:"DROP_AFTER_SECONDS" default:"60"`
}
func GetConfig() Config {
var cfg Config
err := envconfig.Process("", &cfg)
if err != nil {
log.Fatal(err)
}
return cfg
}