Commit Graph

527 Commits

Author SHA1 Message Date
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
Mark Sagi-Kazar a842b8f618 Replace SetKeyDelimiter with functional options 2019-12-06 14:01:42 +01:00
Mark Sagi-Kazar 9a405be5c0 Add SetKeyDelimiter to the README 2019-12-06 14:01:42 +01:00
Mark Sagi-Kazar a73303ee89 Add key delimiter setter 2019-12-06 14:01:42 +01:00
Mark Sagi-Kazar b6ced70067 Generic improvements 2019-12-06 14:01:30 +01:00
Mark Sagi-Kazar 52836e66ad Improve badges 2019-12-06 14:01:30 +01:00
Mark Sagi-Kazar 6895c083d6 INI is supported 2019-12-06 14:01:30 +01:00
Mark Sagi-Kazar c4fedd192b Fix check target 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar 2fd264d3d1 Fix misspell 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar 8b7fbcaa4b Fix golint 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar 29bb3ee94f Fix deadcode 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar 7b5adba788 Fix whitespace 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar cea8b9dfcd Fix goimports 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar e316012b4d Fix gofmt 2019-12-06 13:00:52 +01:00
Mark Sagi-Kazar 78a0e37a24 Add github actions workflow 2019-12-06 12:35:47 +01:00
Mark Sagi-Kazar fae3a81867 Add ide integration 2019-12-06 12:10:03 +01:00
Mark Sagi-Kazar d52c544291 Add Makefile 2019-12-06 12:10:03 +01:00
Mark Sagi-Kazar abdeaff171 Add golangci config 2019-12-06 12:10:03 +01:00
Mark Sagi-Kazar 8feab54f0e Tidy dependencies 2019-12-06 11:22:37 +01:00
Matti R 351bfe9719 loop through ini sections
pass tests

write out ini file & tests

go fmt

Update viper_test.go
fix test

gofmt
2019-12-06 09:02:54 +01:00
javaducky 3a19b6e0d9 Review updates to utilize afero for file checks and updated checks on unit tests 2019-12-06 08:36:52 +01:00
javaducky a708479794 Updating SafeWriteConfig and SafeWriteConfigAs to match documented behavior.
Methods should throw an error if the config file already exists or if no configpath is configured when not explicitly requesting a write path.
2019-12-06 08:36:52 +01:00
Benoit Masson 9e353e395e find() looks for flag's default values only when requested.
Default value should be looked for by Get(), but not by IsSet().

This logic should remain inside find(), to make sure that shadowing
of keys is handled properly.

Fixes Issue #276.
2019-11-29 21:16:13 +01:00
Benoit Masson 4e1ebbdaba Added tests to TestIsSet()
Added tests for:
- nested elements
- environment values
- flags (currently fails => IsSet() always returns true,
                            due to the default value of the flag)
2019-11-29 21:16:13 +01:00
Kévin Dunglas 01d7d76eb0 Add Mercure in the list of projects using Viper 2019-11-08 13:18:39 +01:00
Pedro Silva d1c60d9e69 Support config files with no extensions (#722)
* Support config files with no extensions

* Update README informing config files without extension are supported
2019-11-06 14:54:13 +01:00