mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid viper concurrent access
This commit is contained in:
parent
3c5b0ed8e3
commit
819a85f59a
|
@ -58,6 +58,30 @@ func (vp *ViperProxy) SetDefault(key string, value interface{}) {
|
|||
vp.Viper.SetDefault(key, value)
|
||||
}
|
||||
|
||||
func (vp *ViperProxy) GetString(key string) string {
|
||||
vp.Lock()
|
||||
defer vp.Unlock()
|
||||
return vp.Viper.GetString(key)
|
||||
}
|
||||
|
||||
func (vp *ViperProxy) GetBool(key string) bool {
|
||||
vp.Lock()
|
||||
defer vp.Unlock()
|
||||
return vp.Viper.GetBool(key)
|
||||
}
|
||||
|
||||
func (vp *ViperProxy) GetInt(key string) int {
|
||||
vp.Lock()
|
||||
defer vp.Unlock()
|
||||
return vp.Viper.GetInt(key)
|
||||
}
|
||||
|
||||
func (vp *ViperProxy) GetStringSlice(key string) []string {
|
||||
vp.Lock()
|
||||
defer vp.Unlock()
|
||||
return vp.Viper.GetStringSlice(key)
|
||||
}
|
||||
|
||||
func GetViper() *ViperProxy {
|
||||
v := &ViperProxy{}
|
||||
v.Viper = viper.GetViper()
|
||||
|
|
Loading…
Reference in a new issue