Bjørn Erik Pedersen
6d33b5a963
Make the map in MergeConfigMap case insensitive
2018-12-07 11:03:36 +01:00
Bjørn Erik Pedersen
41cd1c3aa3
Restrict Travis to >= Go 1.11, use Go Modules, and get the test to pass
2018-12-05 17:13:47 +01:00
Bjørn Erik Pedersen
3535c75fa8
Add MergeConfigMap
...
Fixes #605
2018-12-05 17:13:47 +01:00
Bjørn Erik Pedersen
06c7c0d9b3
Use assert.EqualValues for slice checking
2018-11-19 10:38:40 +01:00
Benoit Masson
ae103d7e59
Moved shared resources out of the loops in TestBindPFlagsStringSlice()
...
Common code and resources put out of the loops, to improve
efficiency and readability.
2018-11-07 12:08:59 +01:00
Benoit Masson
69647fb422
Fixed TestBindPFlagsStringSlice()
...
Replaced Visit() by VisitAll(), so that the Changed attribute of
the updated flag is correctly set.
2018-11-07 12:08:59 +01:00
Benoit Masson
cc7e906d88
Updated TestBindPFlagsStringSlice() to highlight a failure
...
When pflag marked as changed, the value is not detected
(and lower priority value used)
2018-11-07 12:08:59 +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
Andrew Stuart
0d783e7344
Use test log
2018-09-28 01:04:19 -07:00
Andrew Stuart
2c12c60302
Fix nil pointer on watch function ( #568 )
2018-09-28 00:53:21 -07:00
Bjørn Erik Pedersen
3171ef9a22
Revert "Add go.sum to .gitignore"
...
This reverts commit 841bd4ebcd
.
2018-09-07 15:06:02 +02:00
Bjørn Erik Pedersen
841bd4ebcd
Add go.sum to .gitignore
...
Seems that it's better practice to keep that in Git for "main modules".
2018-09-07 11:52:15 +02:00
Bjørn Erik Pedersen
8fb6420065
Add go.mod
2018-09-07 11:30:55 +02:00
Dr. Tobias Quathamer
0ac2068de9
Fix overflow error on 32 bit architectures ( #340 )
...
* Handle int64 separately for 32 bit architectures
* Remove tests which result in an overflow error on 32 bit architectures
2018-09-01 14:59:01 -06:00
Adhatama
8addaed22d
Add README.md for Consul remote provider ( #489 )
2018-08-28 16:05:06 -06:00
Aarti Parikh
05116ad639
Revert "fix dep wrong case ( #484 )"
...
This reverts commit b7a62b2c00
.
2018-08-28 02:34:36 -06:00
kun
b7a62b2c00
fix dep wrong case ( #484 )
2018-08-28 01:37:55 -06:00
Robin Brämer
e436d04e6d
correct a comment on viper.Set() ( #553 )
...
correct regiser with register
2018-08-28 01:29:26 -06:00
Michael
40b1bbb9a8
travis: update go versions ( #558 )
2018-08-28 01:08:14 -06:00
Xavier Coulon
41f829b2c9
refactor test to avoid negative counter on WG
...
Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
2018-08-06 09:29:13 +02:00
Xavier Coulon
e12d3d32d1
Merge branch 'master' into Issue284_Kubernetes_config
2018-08-06 08:18:53 +02:00
Chris Reeves
907c19d40d
Support customising mapstructure.DecoderConfig for Unmarshal
...
* Added a new `DecoderConfigOption` type allowing the user to write custom
functions that can override the default mapstructure.DecoderConfig
settings
* Added a new `DecodeHook` function which returns
a `DecoderConfigOption`. This allows the user to easily set their own
Decode hooks when Unmarshaling
* Updated Unmarshal, UnmarshalKey and defaultDecoderConfig to support variadic
trailing `DecoderConfigOption` functions to allow for customisation of
the default mapstructure.DecoderConfig
* Added a test case with example usage
2018-08-03 14:57:45 +02:00
Xavier Coulon
c1250e5dd7
apply review comments
...
use masks for checking the events.
Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
2018-07-13 10:30:23 +02:00
Adriano
d493c32b69
Update README.md ( #470 )
...
Fix typo in the environment variable usage documentation.
2018-07-10 13:30:20 +01:00
Brice Fernandes
fb7a06477f
Add example of marshalling to string ( #531 )
2018-07-10 12:30:24 +01:00
Xavier Coulon
242f4890f5
Refactor with WaitGroup and check channel is open
...
Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
2018-05-24 10:09:29 +02:00
Travis Jeffery
15738813a0
Add GetInt32
2018-05-07 09:10:07 +02:00
Michael Käufl
8dc2790b02
travis: update go versions
2018-04-04 20:33:25 +02:00
Bjørn Erik Pedersen
b5e8006cbe
Undexport GetConfigFile
...
It was exported in previous commit, but we have GetConfigFileUsed -- so use that.
2018-03-19 19:50:19 +01:00
Bjørn Erik Pedersen
00ed41cdba
Export and fix GetConfigFile
2018-03-19 19:12:24 +01:00
Xavier Coulon
e0f7631cf3
WatchConfig and Kubernetes ( #284 )
...
Support override of symlink to config file
Include tests for WatchConfig of regular files, as well
as config file which links to a folder which is itself a
link to another folder in the same "watch dir" (the way
Kubernetes exposes config files from ConfigMaps mounted
on a volume in a Pod)
Also:
- Add synchronization with WaitGroup to ensure that the WatchConfig
is properly started before returning
- Remove the watcher when the Config file is removed.
Fixes #284
Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
2018-01-03 10:37:18 +01:00
Davor Kapsa
aafc9e6bc7
travis: update go versions
2017-12-27 20:41:43 +01:00
Adam Sherwood
1a0c4a370c
Feature/write config ( #287 )
...
* Added method to write into TOML file.
* Added functionality to export configuration based on config type. The feature supports JSON and TOML.
* Added method to write into YAML file.
* Fixed the issue of incorrect defer and error checking order. The error checking must be first otherwise it will cause panic.
* Add WriteConfig methods
* Add support for toml
* Add shared write function and safe methods
* Fix incorrectly modified imports
* Remove extra comments
* Fix spelling
* Make marshal spelling consistent throughout
* Add support for remaining configuration types
This commit moves a significant portion of the code back to viper.go to
facilitate having access to the object when reading the files. The purpose is to
add properties to the viper object at read time, so that we can add the comments
back to the file when writing.
* Add tests for each written file type
* Modify test for updated HCL specification
* Modify to only support HCL write in Go 1.7
* Revert "Modify to only support HCL write in Go 1.7"
This reverts commit 12b34bc4eb92cbf8ebfd56b79519f448607e3e51.
* Need to truncate the file before writing
* Write all settings including overrides
* Use filename variable
* Lint remote.go
* Fix toml return count error
2017-12-06 23:26:31 -05:00
Jeff Lindsay
4dddf7c62e
Allow exists util function to take afero.Fs so it can be used with non-deafult instances of Viper ( #405 )
...
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2017-11-09 21:57:16 +01:00
Kamil Wargula
8ef37cbca7
Fix incorrect name of function in README.md
...
Change `SetEnvReplacer` to `SetEnvKeyReplacer`
2017-10-20 12:40:09 +02:00
Bjørn Erik Pedersen
d9cca5ef33
Go fmt viper.go
2017-09-29 23:06:42 +02:00
Alexander Krasnukhin
266e588e9e
Add string slice support to defaultDecoderConfig
...
This way it correctly decodes string slices as well.
2017-09-29 21:44:38 +02:00
JG²
25b30aa063
Add Clairctl as a Go project that uses Viper
...
See #354
2017-07-22 23:52:07 -06:00
Nick Miyake
8ac2e2e20f
Run gofmt on all existing code
...
Also:
* Add check to .travis.yml that verifies that all code is gofmt-compliant
* Touch up some newlines
See #351
2017-07-22 23:47:47 -06:00
Nick Miyake
f257d19100
Fix a few minor typos/formatting issues with comments
...
See #350
2017-07-22 23:39:01 -06:00
Brad Peabody
04691bc570
Improve documentation for flags
...
See #329
2017-07-22 23:26:21 -06:00
Nikola Kovacs
9766537120
Fix grammar/typo in comment for getEnv()
...
See #310
2017-07-22 23:09:41 -06:00
Albert Nigmatzianov
16a9458573
Fix indentation in README.md
...
See #345
2017-07-22 22:54:24 -06:00
Anthony Fok
df7314a14e
Make minor copy-editing changes to README.md
2017-07-21 04:20:10 -06:00
Albert Nigmatzianov
c1de95864d
Prevent redundant type assertion in Get
...
There is no need to assert variables which already have appropriate
type.
name old time/op new time/op delta
GetBool-4 554ns ± 3% 493ns ± 8% -10.86% (p=0.000 n=14+15)
Get-4 484ns ± 4% 414ns ± 7% -14.37% (p=0.000 n=14+15)
GetBoolFromMap-4 8.38ns ± 6% 7.83ns ± 7% -6.59% (p=0.000 n=15+15)
name old alloc/op new alloc/op delta
GetBool-4 65.0B ± 0% 64.0B ± 0% -1.54% (p=0.000 n=15+15)
Get-4 64.0B ± 0% 64.0B ± 0% ~ (all equal)
GetBoolFromMap-4 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
GetBool-4 5.00 ± 0% 4.00 ± 0% -20.00% (p=0.000 n=15+15)
Get-4 5.00 ± 0% 4.00 ± 0% -20.00% (p=0.000 n=15+15)
GetBoolFromMap-4 0.00 0.00 ~ (all equal)
2017-06-19 14:43:13 +02:00
Nick Miyake
a1ecfa6a20
Fix apostrophes in README
...
Fix "it's" -> "its".
2017-06-10 01:09:38 +02:00
Paweł Szczur
0967fc9ace
Properly handle string slice values
2017-04-17 10:08:15 +02:00