MCPcopy
hub / github.com/spf13/viper / WriteConfigTo

Method WriteConfigTo

viper.go:1642–1650  ·  view source on GitHub ↗
(w io.Writer)

Source from the content-addressed store, hash-verified

1640func WriteConfigTo(w io.Writer) error { return v.WriteConfigTo(w) }
1641
1642func (v *Viper) WriteConfigTo(w io.Writer) error {
1643 format := strings.ToLower(v.getConfigType())
1644
1645 if !slices.Contains(SupportedExts, format) {
1646 return UnsupportedConfigError(format)
1647 }
1648
1649 return v.marshalWriter(w, format)
1650}
1651
1652// SafeWriteConfigAs writes current configuration to a given filename if it does not exist.
1653func SafeWriteConfigAs(filename string) error { return v.SafeWriteConfigAs(filename) }

Callers 1

WriteConfigToFunction · 0.80

Calls 3

getConfigTypeMethod · 0.95
marshalWriterMethod · 0.95
UnsupportedConfigErrorTypeAlias · 0.85

Tested by

no test coverage detected