Adrian Maurer
09ab207375
fix: lint
2021-09-21 10:27:11 -04:00
Adrian Maurer
e354c1be00
Merge branch 'master' into master
2021-09-21 10:22:45 -04:00
Adrian Maurer
ed154ee610
fix: conflicts
2021-09-21 10:15:26 -04:00
Jim Razmus II
b1fdc47b0d
Recognize tfvars files as hcl by default.
...
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-19 23:25:03 +02:00
Séra Zoltán
fa3412d7ea
fix cannot write hidden file without extension ( #1017 )
2021-09-19 09:28:14 +02:00
Vasily Ovchinnikov
e606f7496e
fix: made `InConfig` process paths correctly
2021-09-16 10:32:19 +02:00
Adrian Maurer
29eaef3bf7
feat: add cue encoder ( #1 )
...
* feat: add cue encoder
* wip: cleanup and comments
* fix: extensions
fix: remove print statement (#3 )
fix: marshal val to byte
fix: straight decode
2021-07-22 11:29:09 -04:00
Mark Sagi-Kazar
a02f9864fa
feat(encoding): Integrate the new encoding package into Viper
...
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-06-25 14:26:08 +02:00
Mikhail f. Shiryaev
bd03865899
Add a proper processing for pflag.StringArray
2021-06-25 13:55:36 +02:00
Carlos Henrique Guardão Gandarez
acd965b54e
Add ini load options argument
...
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-06-16 01:55:16 +02: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
r-stepanenko
fb4eafdd97
fix INI saving panics ( #1075 )
2021-03-10 14:46:19 +01: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
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
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
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
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
Oleg Butuzov
13494e8047
Skipping error != nil checks in favor of the fast return.
2020-07-16 06:22:21 +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
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
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
Mark Sagi-Kazar
f2cbaea4c2
Fix copy-paste error in documentation
...
Fixes #825
2020-01-16 19:54:31 +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
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
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
a73303ee89
Add key delimiter setter
2019-12-06 14:01:42 +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
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
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
Vivek V
72b022eb35
Added capacity to slice creation
2019-11-01 11:15:09 +01:00
Mark Sagi-Kazar
71509d2887
Revert the effective changes of #673
2019-09-28 12:02:57 +02:00
inkychris
99520c81d8
Implemented ability to unmarshal keys containing dots to structs.
...
Changed formatting of test objects for better git diffing and readibility.
Fixed failing tests on Windows.
2019-09-11 16:03:08 +02:00
TwiN
e697d557b7
Fix small typo
2019-08-17 00:18:41 +02:00
Christian Muehlhaeuser
33bf76add3
Simplify code
...
Removed unnecessary conversions.
2019-07-29 18:37:00 +02:00
Christian Muehlhaeuser
1b33e8258e
Add error handling
...
Added error handling around ineffectual err assignments. Please review
thoroughly.
2019-07-28 14:50:13 +02:00
Christian Muehlhaeuser
d65fa7608b
Fixed typo
...
Just a nitpicky typo fix.
2019-07-28 14:47:04 +02:00