Torben Nehmer
7dd11a0879
- NFT and DNS Update skeletons - Integrated viper configuration management - Integrated cobra CLI management - Basic webservice skeleton
24 lines
314 B
Go
24 lines
314 B
Go
package webapi
|
|
|
|
import (
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
type config struct {
|
|
ListenAddress string
|
|
}
|
|
|
|
var C config
|
|
|
|
func init() {
|
|
SetConfigDefaults()
|
|
}
|
|
|
|
func SetConfigDefaults() {
|
|
viper.SetDefault("WebAPI.ListenAddress", ":8080")
|
|
}
|
|
|
|
func LoadConfig() {
|
|
C.ListenAddress = viper.GetString("WebAPI.ListenAddress")
|
|
}
|