dyndns/service/config.go

25 lines
434 B
Go
Raw Normal View History

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