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
Rodrigo Chiossi
cdccc8152c
Fix SafeWriteConfig
...
If the config file does not exist and the force flag is not set,
OpenFile would not use O_CREATE flag, causing viper to fail with
error "File not exist" and to not create the config file.
This patch changes the behavior of writeConfig() so that if force is set
to false, OpenFile will use O_EXCL flag, thus failing if the file
already exists or creating a new file otherwise.
Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-07-28 12:33:29 +02:00
bpizzi
e02bc9eca5
Fixed missing f.Close() in writeConfig()
...
Defering can cause trouble because we're writing to the file outside the function
where the defering is registered, calling f.Sync() ensures that bytes are flushed
to disk even is Close() is called too soon.
2019-07-13 12:28:02 +02:00
Nicolas Martin
e325492b82
Add missing call to initWF.Done()
2019-07-13 12:13:30 +02:00
Márk Sági-Kazár
e6d1c6bc9a
Improve godoc
2019-07-13 12:11:16 +02:00
CodeLingo Bot
275a36d0a0
Fix function comments based on best practices from Effective Go
...
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-07-13 12:11:16 +02:00
Márk Sági-Kazár
7fdad0204e
Fix typo
2019-07-13 12:04:36 +02:00
AGirard
b8221cf4ee
Add GetIntSlice helper method
2019-07-13 12:04:36 +02:00
Márk Sági-Kazár
ad5ed02fa4
Add support for int slice flags ( #637 )
...
* Add support for int slice flags
* Add int slice test to unmarshal
2019-06-11 16:51:57 -04:00
mexisme
3620d3d9e1
Support `.env` format files ( #528 )
...
* Support `.env` format files
* Missing "dotenv" from SupportedExtns
2019-06-11 16:47:43 -04:00
Mitch Connors
7a605a50e6
Uint Support ( #681 )
...
* add GetUint/GetUint32/GetUint64
* Add Get(string) support for uint.
2019-04-08 10:06:45 -04:00
Kris
fccfc2c271
Add API for setting file permissions
2019-04-04 14:02:01 +02:00
Bjørn Erik Pedersen
9e56dacc08
Remove superflous insensitiviseMaps in Unmarshal methods
...
Fixes #482
2019-03-13 10:29:51 +01:00
Bjørn Erik Pedersen
6d33b5a963
Make the map in MergeConfigMap case insensitive
2018-12-07 11:03:36 +01:00
Bjørn Erik Pedersen
3535c75fa8
Add MergeConfigMap
...
Fixes #605
2018-12-05 17:13:47 +01:00
Márk Sági-Kazár
b7a3b95476
Lookup environment variables instead of checking if the value is empty
...
This commit adds an `AllowEmptyEnv` option that, default off, that when set will allow set, but empty, environment variables
Fixes #317
2018-11-06 22:53:21 +01:00
Andrew Stuart
62edee3196
Revert "Cater for case-sensitive dependencies ( #463 )"
...
This reverts commit b56071875a
.
2018-09-29 21:41:27 -07:00
Panagiotis Moustafellos
b56071875a
Cater for case-sensitive dependencies ( #463 )
...
Switching jww from jwalterweatherman to jWalterWeatherman for cases when vgo is broken
2018-09-29 20:32:38 -07:00
Andrew Stuart
8e194e8ad2
Merge branch 'master' into mergefix/Issue284_Kubernetes_config
2018-09-28 01:05:04 -07:00