|
|
@ -9,6 +9,20 @@ import ( |
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
|
) |
|
|
|
|
|
|
|
var ( |
|
|
|
ConfigurationFileDirectory DirectoryValueType |
|
|
|
) |
|
|
|
|
|
|
|
type DirectoryValueType string |
|
|
|
|
|
|
|
func (s *DirectoryValueType) Set(value string) error { |
|
|
|
*s = DirectoryValueType(value) |
|
|
|
return nil |
|
|
|
} |
|
|
|
func (s *DirectoryValueType) String() string { |
|
|
|
return string(*s) |
|
|
|
} |
|
|
|
|
|
|
|
type Configuration interface { |
|
|
|
GetString(key string) string |
|
|
|
GetBool(key string) bool |
|
|
@ -21,6 +35,7 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) { |
|
|
|
|
|
|
|
// find a filer store
|
|
|
|
viper.SetConfigName(configFileName) // name of config file (without extension)
|
|
|
|
viper.AddConfigPath(ResolvePath(ConfigurationFileDirectory.String())) // path to look for the config file in
|
|
|
|
viper.AddConfigPath(".") // optionally look for config in the working directory
|
|
|
|
viper.AddConfigPath("$HOME/.seaweedfs") // call multiple times to add many search paths
|
|
|
|
viper.AddConfigPath("/usr/local/etc/seaweedfs/") // search path for bsd-style config directory in
|
|
|
|