Torben Nehmer
7dd11a0879
- NFT and DNS Update skeletons - Integrated viper configuration management - Integrated cobra CLI management - Basic webservice skeleton
25 lines
434 B
Go
25 lines
434 B
Go
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")
|
|
}
|