aboutsummaryrefslogtreecommitdiff
path: root/weed/util/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/util/config.go')
-rw-r--r--weed/util/config.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/weed/util/config.go b/weed/util/config.go
index 7b86b749e..dfbfdbd82 100644
--- a/weed/util/config.go
+++ b/weed/util/config.go
@@ -1,8 +1,11 @@
package util
import (
- "github.com/chrislusf/seaweedfs/weed/glog"
+ "strings"
+
"github.com/spf13/viper"
+
+ "github.com/chrislusf/seaweedfs/weed/glog"
)
type Configuration interface {
@@ -37,3 +40,11 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) {
return true
}
+
+func GetViper() *viper.Viper {
+ v := viper.GetViper()
+ v.AutomaticEnv()
+ v.SetEnvPrefix("weed")
+ v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
+ return v
+}