Commit graph

370 commits

Author SHA1 Message Date
Pablo Alvarez de Sotomayor Posadillo
55f6336645
Add a new Unset function to remove a key from viper.
In some circunstances, you want to remove a key for your config in
viper, so, instead of setting the key value to nil, it's better to
have a new Unset function to remove the key from the inner map.
2021-02-21 20:46:38 +01:00
Mark Sagi-Kazar
4613c4a95f docs: move troubleshooting to a new document
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-02-15 07:47:45 +01:00
Mark Sagi-Kazar
a86148e76e docs: add note about go modules to the readme
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-02-15 07:47:45 +01:00
Mark Sagi-Kazar
e66f940bcc docs: add troubleshooting guide about package not being found
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-02-15 07:47:45 +01:00
Mark Sagi-Kazar
d10c856f6c Add discussions to issue links
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-01-11 03:55:13 +01:00
Márk Sági-Kazár
da70fee083
Add troubleshooting about unmarshaling 2020-12-17 22:13:27 +01:00
Mark Sagi-Kazar
99da8b22a1
Add labels to issue templates
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-12-11 17:36:00 +01:00
Mark Sagi-Kazar
811f0e6937
Add issue and PR templates
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-12-11 17:33:03 +01:00
Mark Sagi-Kazar
bba82cfc61 docs: add run on repl.it badge with example
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-12-03 01:43:52 +01:00
Benjamin Lee
6ddd35486b Always quote $@ 2020-12-02 14:59:11 +01:00
Márk Sági-Kazár
493643fd5e
Update README.md 2020-11-03 14:29:48 +01:00
Pablo Santiago Blum de Aguiar
f415025b98 Fix a minor typo in README.md 2020-10-30 23:19:06 +01:00
Meysam GanJi
4938331709 fix typo 2020-10-12 09:45:20 +02:00
Mark Sagi-Kazar
8c89438499
docs: improve AutomaticEnv documentation
Fixes #1000

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-10-08 02:46:11 +02:00
dylandreimerink
33bcdc91ea
Added support for accessing slices (#861)
* Added support for accessing slices

* Processed PR feedback
- renamed searchMapWithPathPrefixes to searchIndexableWithPathPrefixes
- moved source type specific search logic to speparate functions
- Inverted if statments to avoid the arrow pattern

* Quickly return from searchSliceWithPathPrefixes and searchMapWithPathPrefixes functions without intermediate variables
2020-10-04 20:07:34 +02:00
Mark Sagi-Kazar
44e6ee8945
Use pull_request_target event in PR feedback
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-10-03 17:48:38 +02:00
Mark Sagi-Kazar
656b8771b8
Revert "Remove pull request feedback"
This reverts commit 0a45372c6c.
2020-10-03 17:48:08 +02:00
Mark Sagi-Kazar
0a45372c6c
Remove pull request feedback
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-10-01 22:37:29 +02:00
Mark Sagi-Kazar
82c2ddf493 Fix tests broken by mapstructure update
Mapstructure so far returned nil for empty string slices.
In a recent version this bug has been fixed:
https://github.com/mitchellh/mapstructure/pull/155

Incidentally, this was a bug in Viper too:

GetStringSlice and Unmarshal returned with different values.

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 15:03:37 +02:00
Mark Sagi-Kazar
16dc0f72ce chore(deps): update mapstructure dependency
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 15:03:37 +02:00
Mark Sagi-Kazar
f67a901790 docs: add go version badge and update pkg.go.dev badge
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 13:15:51 +02:00
Mark Sagi-Kazar
d2df377935 ci: drop tests for Go 1.11-1.13
The Cleanup function used in this PR is only available from Go 1.14

While it would be nice to support more Go versions,
Go itself does not support other than the last two,
so that should be fine for Viper as well.

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 13:15:51 +02:00
Mark Sagi-Kazar
cfcfed504d refactor: add setenv helper for tests
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 13:15:51 +02:00
Gabriel Aszalos
ea890285a5 Update docs 2020-09-30 12:44:21 +02:00
Gabriel Aszalos
b655224c01 Allow BindEnv to register multiple environment variables.
This change modifies BindEnv to permit a list of environment variable
names in order to support multiple env. vars. for the same config key.
When this form is used, env. keys take precedence in the written order.

Closes #971
2020-09-30 12:44:21 +02:00
Mark Sagi-Kazar
b534983313
Add some emojis to feedback bot
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 09:25:53 +02:00
Mark Sagi-Kazar
f3c095442f
Add some emojis to feedback bot
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 09:23:52 +02:00
Mark Sagi-Kazar
dd2e0fa15f
Add feedback bot to pull request
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 09:16:23 +02:00
Mark Sagi-Kazar
bed424f7c0
Add feedback bot to issue
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-30 09:13:00 +02:00
Mark Sagi-Kazar
29c3027c49
docs: rewrite sub documentation
Fixes #988
Fixes #987

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-27 22:59:46 +02:00
Mark Sagi-Kazar
6d4eb764b6
Add feedback form to the readme
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-27 01:06:10 +02:00
Mark Sagi-Kazar
406ea27dc0
Add feedback form to the readme
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-27 01:04:34 +02:00
Dan Rollo
a0285163e1 ensure BindPFlag() detects a nil flag parameter before wrapping in pflagValue. 2020-09-23 19:29:16 +02:00
Mark Sagi-Kazar
d9d7dcdc63 Increase lint timeout
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-11 17:53:37 +02:00
Mark Sagi-Kazar
a5152092c6 Improve lint rules
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-11 17:53:37 +02:00
Mark Sagi-Kazar
ae12c841bc
Upgrade linter
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-11 17:43:32 +02:00
Mark Sagi-Kazar
387404d518 Add log for remote config errors
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-09 22:37:34 +02:00
Mark Sagi-Kazar
f26928cd87
Add Go 1.15 to the build matrix
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-09 22:32:07 +02:00
Mark Sagi-Kazar
9c7144ec1e
Build on both linux and macos
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2020-09-05 23:53:06 +02:00
John Gosset
3826be3135 Simplify $HOME prefix check 2020-07-31 23:39:06 +02:00
João Abecasis
ce534045f9 Fix environment variable expansion in absPathify
- Don't expand user home directory for variable names that simply have a
  HOME prefix;
- Support expansion of variables not followed by the path separator.
2020-07-31 23:39:06 +02:00
Oleg Butuzov
13494e8047 Skipping error != nil checks in favor of the fast return. 2020-07-16 06:22:21 +02:00
Mark Sagi-Kazar
13df721090
Add Go 1.14 to build targets 2020-05-09 11:42:39 +02:00
Trevor Foster
3856c05f99
Fix: Getting the value of a StringToString pflag (#874)
* add parsing for stringToString flags

* add logic to return flags default if not val set, add a test

* extract parsing into single func

* add a few more cases

* return nil if unable to parse instead of panicing

* return map[string]interface in order to work with cast.ToStringMap

* mostly copy pflags implementation of the conversion to a stringtostring
2020-05-09 11:38:39 +02:00
flow00
c6ee9808ab fix_ini_save_error 2020-05-05 12:50:28 +02:00
John McBride
c42a305a4b
Update gorilla dependency (#899)
* Update gorilla dependency

* Run go mod tidy
2020-04-21 17:18:44 +02:00
Mark Sagi-Kazar
e34fb51dd7
Add mentioned in awesome badge 2020-04-09 23:56:02 +02:00
Mark Sagi-Kazar
7eea3718bf
Remove go version badge 2020-04-09 22:21:21 +02:00
Mark Sagi-Kazar
aa8e4d4983
Update badges and logo 2020-04-09 22:20:35 +02:00
Mark Sagi-Kazar
9b03d15591
Ignore idea 2020-04-09 20:15:13 +02:00