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 }