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")
|
||
|
}
|