Commit Graph

379 Commits

Author SHA1 Message Date
Frediano Ziglio ab4327a019 Avoid having 2 goroutines to handle file changes
On goroutine was just waiting the goroutine handing the events
just to keep the "watcher" variable alive.
Move defer to event handling goroutine and avoid one goroutine.

Signed-off-by: Frediano Ziglio <fziglio@cyral.com>
2021-05-26 10:21:45 +01:00
Frediano Ziglio 24f5069098 Remove double and 2021-05-26 10:21:45 +01:00
Carolyn Van Slyck cdb5e5976f Fix merging a key into a nil target
When merging a key where the target value is nil, the type of the target
and source do not match. What currently happens is an error is logged
and the key is skipped.

I have changed it so that it does the same thing as when the target key
is missing: copy the source value to the target.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
2021-05-17 08:55:31 +02:00
Mark Sagi-Kazar 36be6bf91f feat: make sure Viper compiles on WASM
fsnotify is not available on WASM,
so config watching is not going to work.

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-04-24 10:24:23 +02:00
Chris Waldon 727a41c38a doc: add a note about concurent Get/Set to godoc 2021-04-15 18:20:20 +02:00
Chris Waldon cb41ae0ab8 doc: discuss concurrency in README 2021-04-15 18:20:20 +02:00
Mark Sagi-Kazar 7fdb267c73 chore: update dependencies
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-04-15 18:12:07 +02:00
Mark Sagi-Kazar 52536944d5 ci: add Go 1.16 to build matrix
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-03-15 09:30:15 +01:00
r-stepanenko fb4eafdd97
fix INI saving panics (#1075) 2021-03-10 14:46:19 +01:00
bridgetbarnes 3c7b44f0bc
Update afero version (CVE-2020-14040) (#1090)
* Update afero version

* Ran go mod tidy
2021-03-10 14:45:23 +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