package service import "github.com/spf13/viper" type config struct { DNSServer string DNSDefaultTTL uint32 UsersConfigDir string } var C config func init() { SetConfigDefaults() } func SetConfigDefaults() { viper.SetDefault("Service.DNS.Server", "10.10.11.254:53") viper.SetDefault("Service.DNS.DefaultTTL", 60) viper.SetDefault("Service.Users.ConfigDir", "users/") } func LoadConfig() { C.DNSServer = viper.GetString("Service.DNS.Server") C.DNSDefaultTTL = viper.GetUint32("Service.DNS.DefaultTTL") C.UsersConfigDir = viper.GetString("Service.Users.ConfigDir") }