Merge pull request #2 from giantswarm/read-raw-config

read raw configuration by given bytes
This commit is contained in:
Tim Schindler 2015-01-24 00:56:15 +01:00
commit f783671488

View file

@ -559,6 +559,15 @@ func (v *Viper) ReadInConfig() error {
return nil return nil
} }
// ReadInRawConfig reads the given raw bytes to load configuration. It is
// necessary to call SetConfigType(), to let viper know how to parse the given
// configuration.
func ReadInRawConfig(raw []byte) error { return v.ReadInRawConfig(raw) }
func (v *Viper) ReadInRawConfig(raw []byte) error {
v.marshalReader(bytes.NewReader(raw), v.config)
return nil
}
func ReadRemoteConfig() error { return v.ReadRemoteConfig() } func ReadRemoteConfig() error { return v.ReadRemoteConfig() }
func (v *Viper) ReadRemoteConfig() error { func (v *Viper) ReadRemoteConfig() error {
err := v.getKeyValueConfig() err := v.getKeyValueConfig()