Commit graph

255 commits

Author SHA1 Message Date
EwvwGeN
2a4be09743
Merge e5316b8387 into 2e9148610a 2024-04-09 08:13:26 -04:00
sandeep
2e9148610a
fix #1700: update tests to use local viper instance (#1791)
* fix:test to use local viper instance

* fix linting

* fix typo

* remove unsed function
2024-04-07 13:09:02 +02:00
EwvwGeN
e5316b8387 feat: new settings for viper, edit processing of an aliases 2024-02-06 17:00:06 +03:00
Mark Sagi-Kazar
473a3dfc7f fix!: hide struct binding behind a feature flag
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-12-18 19:36:22 +01:00
Filip Krakowski
fb6eb1e8e9 fix: merge missing struct keys inside UnmarshalExact 2023-12-08 14:44:05 +01:00
linuxsong
f7363633d1
fix isPathShadowedInFlatMap type cast bug (#1585)
* fix isPathShadowedInFlatMap type cast bug

* Add "IsPathShadowedInFlatMap" method unit test

* fix: typo

* add an unit test for flag shadow

---------

Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
2023-12-06 14:41:36 +01:00
Oleksandr Redko
36a38682ba Review changes 2023-12-06 19:07:50 +07:00
Oleksandr Redko
f0c4ccd6cd fix: gocritic lint issues 2023-12-06 19:07:50 +07:00
Mark Sagi-Kazar
73dfb94c57 feat: make Unmarshal work with AutomaticEnv
Co-authored-by: Filip Krakowski <krakowski@hhu.de>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-12-06 18:44:04 +07:00
Mark Sagi-Kazar
6ea31ae4ca refactor: move all settings code to a getter
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-12-06 18:44:04 +07:00
Oleksandr Redko
c4dcd31f68 fix: godot lint issues 2023-11-30 21:20:53 +07:00
Mark Sagi-Kazar
464cdab72a refactor: drop fsonitfy wrapper
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-11-30 00:24:02 +07:00
Ville Skyttä
f62f86a84b refactor: make use of strings.Cut 2023-10-06 14:22:22 +02:00
Oleksandr Redko
3d006fe361 refactor: replace interface{} with any 2023-10-01 17:04:26 +02:00
Mark Sagi-Kazar
d16deb4b93 feat: add slog support
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-09-13 16:24:59 +02:00
John Hooks
1e811d1f02 Add NATS support 2023-09-08 15:32:50 +02:00
guangwu
cb9b2bffc2
fix: code optimization (#1557)
* fix: code optimization

* fix: golangci-lint
2023-07-27 20:56:32 +02:00
Baruch Odem
731a91be43 feat: add func GetEnvPrefix 2023-06-29 05:37:45 +02:00
Márk Sági-Kazár
53cdb5253a chore: improve log messages 2023-05-29 15:43:38 +02:00
Quentin Burgess
24ece16a9a drop std' logger in favor of jww one 2023-05-29 15:43:38 +02:00
Quentin Burgess
98b1b9fd42 add:viper: allow to disable internal log messages 2023-05-29 15:43:38 +02:00
VOrishirne
2ee16310d0 extend viper's pflag binding to stringToInt pflag 2023-05-29 15:34:52 +02:00
Márk Sági-Kazár
34d6318c0b chore: fix typo 2023-03-31 13:08:16 +02:00
Yoofi Quansah
c6ba8f4702 fix: fix typo 2023-03-31 13:08:16 +02:00
TaylorOno
3970ad177e Preserve envPrefix in Sub 2023-02-25 22:17:36 +01:00
TaylorOno
3f4449054d Sub inerits from automaticEnvApplied and envKeyReplacer
parents are tracked so sub(x).sub(y).GetString(z) looks up x.y.z
2023-02-25 22:17:36 +01:00
Dawid Urbański
c898f59d33
fix: time.Duration slice type conversion (#1498)
* fix DurationSlice

* Fix typo

---------

Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
2023-02-05 18:30:05 +01:00
glebik000
5182412574
Add DocBlock to WatchConfig (#1467)
* Add DocBlock to WatchConfig

Added a small description of the WatchConfig().
So that you can understand in the ide why you could use it.

* Update viper.go

* update viper.go

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
Co-authored-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-01-19 16:38:18 +01:00
Mark Sagi-Kazar
4b8d14881e refactor: use new Has fsnotify method for event matching
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2022-11-04 05:39:26 +01:00
Brad P. Crochet
312417a0c5 Add a DebugTo convenience funtion
One might want to write the debug information somewhere other than
Stdout. This patch adss a DebugTo function and method, that accepts
an io.Writer. It changes the original Debug implementation to call
this new function with a default of os.Stdout, which maintains
backward compatibility.

Signed-off-by: Brad P. Crochet <brad@redhat.com>
2022-09-06 11:14:22 +02:00
Christian Banse
202060b3a2 Adds support for uint16 with GetUint16
We have encountered numerous places where it is convenient to have viper return a `uint16` value, especially in combination with the new `netip` package  that represents a port correctly as `uint16` rather than just an `int`. cobra already supports this, but we need a conversion from the existing `GetUint` method in viper.
2022-09-04 03:07:23 +02:00
Mark Sagi-Kazar
97591f0083 build: fix lint violations
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2022-09-03 19:07:15 +02:00
Kevin Franklin Kim
98c63ede11 feat: check providers and log error 2022-07-10 13:48:18 +02:00
Kevin Franklin Kim
1bc0a5ac7a add etcd3 to supported providers 2022-07-10 13:48:18 +02:00
Wade Carpenter
da55858fff chore: fix Error log calls in mergeMaps
The logger interface uses k,v pairs, but it was being called with a
format string, here.

Changed to use k,v pairs.

I didn't find any other instances of this problem.
2022-05-26 16:01:47 +02:00
Michael Wilson
f50ce904a9 Add in MustBindEnv.
Adds in a MustBindEnv function which will panic if BindEnv fails.
2022-05-26 15:53:50 +02:00
Mark Sagi-Kazar
55fac1047e chore: fix lint
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2022-04-13 13:22:15 +02:00
Illarion Kovalchuk
97664ba020 Added test case for merging configs, where target is null, and source is not null 2022-01-11 22:36:46 +01:00
illarion Kovalchuk
0353c6ea50 Allow merging configs with different types of leaf values 2022-01-11 22:36:46 +01:00
Mark Sagi-Kazar
04d3a0cb02 feat(encoding): integrate dotenv codec into Viper
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-12-15 22:31:11 +01:00
Mark Sagi-Kazar
72453f720e feat(encoding): integrate Java properties codec into Viper
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-12-15 22:31:11 +01:00
Mark Sagi-Kazar
430936044e feat(encoding): integrate ini codec into Viper
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-12-15 22:31:11 +01:00
Mark Sagi-Kazar
dd62da434f refactor(encoding): initialize codecs per Viper
Some codecs might have options that rely on Viper in the future
(eg. key delimiter) which requires initializing codecs
for each Viper instance.

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-12-15 22:31:11 +01:00
Mark Sagi-Kazar
e54e7a53a5 feat(encoding)!: accept a map in the decoder interface
This interface is specific to decoding data into Viper's internal,
so it's okay to make it Viper specific.

BREAKING CHANGE: the decoder interface now accepts a map instead of an
interface

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-12-15 22:31:11 +01:00
Stephen Wodecki
6c1745665b unnecessary operand 2021-12-15 22:26:56 +01:00
Mark Sagi-Kazar
a785a79f22 refactor: replace jww with the new logger interface 2021-12-09 18:58:22 +01:00
Mark Sagi-Kazar
41ec2aaf27 chore: run lint fixer
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-11-21 14:51:34 +01:00
Mark Sagi-Kazar
4e595cec77 feat: use io/fs for searching files on Go 1.16+
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-21 18:01:05 +02: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