Commit Graph

502 Commits

Author SHA1 Message Date
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
Gustavo Bazan 97ee7adfef
Add support to save file with no extension (#813)
* Add support to save file with no extension

The support introduced for files with no file extension is only partial as trying to save the config file would fail with `<file name> requires valid extension`
This adds support to saving such files
2020-02-20 00:41:04 +01:00
Alexey Maslov b31a49291e updated docs in README. 2020-02-20 00:36:32 +01:00
Alexey Maslov 9c81997cb1 added firestore support. 2020-02-20 00:36:32 +01:00
Alexey Maslov 502400c0d9 changed github.com/xordataexchange/crypt to github.com/bketelsen/crypt. 2020-02-20 00:36:32 +01:00
aeneasr 7ddaa61d67 Remove .idea directory 2020-02-20 00:27:03 +01:00
Mark Sagi-Kazar f2cbaea4c2
Fix copy-paste error in documentation
Fixes #825
2020-01-16 19:54:31 +01:00
Mark Sagi-Kazar df9f4af211
Remove travis config 2020-01-16 19:38:02 +01:00
Mark Sagi-Kazar 1b7d3e05fd
Improve golangci config 2020-01-16 19:37:50 +01:00
Mark Sagi-Kazar 16fb4b9d29
Add editorconfig 2020-01-16 19:37:42 +01:00
Mark Sagi-Kazar 4525543ce4
Improve CI 2020-01-16 19:27:10 +01:00
Pedro Silva 9cd571279d Extensionless files only allowed when config type is set (#827)
* Only consider files without extension if the config type is explicitly specified

* Hides unused variable in test

* First check for config type then for file without extension
2020-01-16 19:23:50 +01:00
Mark Sagi-Kazar 06ab5a4b62 Add documentation about unmarshaling into embedded structs 2020-01-08 10:58:26 +01:00
Mark Sagi-Kazar eabbc68a3e Fix file path lookup 2019-12-06 17:29:42 +01:00
Mark Sagi-Kazar 5ad4bc05cf Add decoder opts to unmarshal exact 2019-12-06 14:27:22 +01:00
Gregory Haynes bcb420b705 Add global UnmarshalExact method
There is no helper method for UnmarshalExact which calls the
corresponding method on the global viper instance.
2019-12-06 14:15:02 +01:00
Mark Sagi-Kazar 4ad4c8df70 Add string replacer interface and env key replacer option 2019-12-06 14:13:46 +01:00
Mark Sagi-Kazar 6fcf985c5a Fix readme 2019-12-06 14:01:42 +01:00
Mark Sagi-Kazar bdf2db0ff8 Fix goimports 2019-12-06 14:01:42 +01:00