lobby2/cli/config.go

29 lines
655 B
Go
Raw Permalink Normal View History

2024-12-08 01:30:07 +00:00
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:"/var/lib/lobby2/config.json"`
NodeDirPath string `envconfig:"NODE_DIR_PATH" default:"/var/lib/lobby2/node"`
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
}