29 lines
655 B
Go
29 lines
655 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:"/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
|
||
|
}
|