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:""`
|
|
|
|
|
2024-12-09 01:00:38 +00:00
|
|
|
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"`
|
2024-12-08 01:30:07 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|