mirror of
https://github.com/spf13/viper
synced 2025-05-06 12:17:18 +00:00
Merge pull request #2 from giantswarm/read-raw-config
read raw configuration by given bytes
This commit is contained in:
commit
f783671488
1 changed files with 9 additions and 0 deletions
9
viper.go
9
viper.go
|
@ -559,6 +559,15 @@ func (v *Viper) ReadInConfig() error {
|
|||
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 (v *Viper) ReadRemoteConfig() error {
|
||||
err := v.getKeyValueConfig()
|
||||
|
|
Loading…
Add table
Reference in a new issue