11> ## Viper v2 Feedback
2- > Viper is heading towards v2 and we would love to hear what _ ** you** _ would like to see in it. Share your thoughts here: https://forms.gle/R6faU74qPRPAzchZ9
2+ >
3+ > Viper is heading towards v2 and we would love to hear what _ ** you** _ would
4+ > like to see in it. Share your thoughts here:
5+ > https://forms.gle/R6faU74qPRPAzchZ9
36>
47> ** Thank you!**
58
69![ viper logo] ( https://github.com/user-attachments/assets/acae9193-2974-41f3-808d-2d433f5ada5e )
710
8-
911[ ![ Mentioned in Awesome Go] ( https://awesome.re/mentioned-badge-flat.svg )] ( https://github.com/avelino/awesome-go#configuration )
1012[ ![ run on repl.it] ( https://repl.it/badge/github/sagikazarmark/Viper-example )] ( https://repl.it/@sagikazarmark/Viper-example#main.go )
1113
@@ -88,7 +90,6 @@ Viper requires minimal configuration to load config files. Viper currently suppo
8890* JSON
8991* TOML
9092* YAML
91- * HCL
9293* INI
9394* envfile
9495* Java Propeties
@@ -268,9 +269,9 @@ id := viper.Get("id") // 13
268269 the next configuration source, unless ` AllowEmptyEnv ` is used.
269270* Viper does not "cache" environment variables--the value will be read each
270271 time it is accessed.
271- * ` SetEnvKeyReplacer ` and ` EnvKeyReplacer ` allow you to use to rewrite Env
272- keys, which is useful to combine SCREAMING_SNAKE_CASE environment variables
273- to merge with kebab-cased configuration values from other sources.
272+ * ` SetEnvKeyReplacer ` and ` EnvKeyReplacer ` allow you to rewrite environment
273+ variable keys, which is useful to merge SCREAMING_SNAKE_CASE environment
274+ variables with kebab-cased configuration values from other sources.
274275
275276### Working with Flags
276277
@@ -373,8 +374,7 @@ provided below.
373374* Firestore
374375* NATS
375376
376- Viper will read a config string (as JSON, TOML, YAML, HCL or envfile) retrieved
377- from a path in a key/value store.
377+ Viper will read a config string retrieved from a path in a key/value store.
378378
379379Viper supports multiple hosts separated by ` ; ` . For example:
380380` http://127.0.0.1:4001;http://127.0.0.1:4002 ` .
@@ -398,7 +398,7 @@ $ crypt get -plaintext /config/hugo.json
398398See the Crypt documentation for examples of how to set encrypted values, or
399399how to use Consul.
400400
401- ### Remote Key/Value Store Examples (unencrypted )
401+ ### Remote Key/Value Store Examples (Unencrypted )
402402
403403#### etcd
404404
@@ -453,7 +453,7 @@ viper.SetConfigType("json")
453453err := viper.ReadRemoteConfig ()
454454```
455455
456- ### Remote Key/Value Store Examples (encrypted )
456+ ### Remote Key/Value Store Examples (Encrypted )
457457
458458``` go
459459viper.AddSecureRemoteProvider (" etcd" ," http://127.0.0.1:4001" ," /config/hugo.json" ," /etc/secrets/mykeyring.gpg" )
@@ -496,7 +496,7 @@ go func(){
496496
497497## Getting Values From Viper
498498
499- THe simplest way to retrieve configuration values from Viper is to use ` Get* `
499+ The simplest way to retrieve configuration values from Viper is to use ` Get* `
500500functions. ` Get ` will return an any type, but specific types may be retrieved
501501with ` Get<Type> ` functions.
502502
@@ -582,8 +582,8 @@ cache1 := NewCache(cache1Config)
582582
583583### Unmarshaling
584584
585- You also have the option of Unmarshaling all or a specific value to a struct,
586- map, and etc., using ` Unmarshal* ` methods.
585+ You also have the option of unmarshaling configuration to a struct, map, etc. ,
586+ using ` Unmarshal* ` methods.
587587
588588``` go
589589type config struct {
@@ -663,9 +663,9 @@ default.
663663
664664### Marshalling to String
665665
666- You may need to marshal all the settings held in viper into a string rather
667- than write them to a file. You can use your favorite format's marshaller with
668- the config returned by ` AllSettings ` .
666+ You may need to marshal all the settings held in Viper into a string. You can
667+ use your favorite format's marshaller with the config returned by
668+ ` AllSettings ` .
669669
670670``` go
671671import (
@@ -684,10 +684,9 @@ func yamlStringSettings() string {
684684
685685### Decoding Custom Formats
686686
687- A frequently requested feature for Viper is adding more value formats and
688- decoders. For example, parsing character (dot, comma, semicolon, etc) separated
689- strings into slices. This is already available in Viper using mapstructure
690- decode hooks.
687+ A frequently requested feature is adding more value formats and decoders (for
688+ example; parsing character delimited strings into slices. This is already
689+ available in Viper using mapstructure decode hooks.
691690
692691Read more in [ this blog
693692post] ( https://sagikazarmark.hu/blog/decoding-custom-formats-with-viper/ ) .
0 commit comments