Commit graph

275 commits

Author SHA1 Message Date
Justin Toman
f0483c5d9e
fix: apply envPrefix to all BindEnv vars 2024-06-26 17:49:09 -05:00
Mark Sagi-Kazar
d2458a2abc feat: allow setting a default decode hook
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 18:31:41 +02:00
Mark Sagi-Kazar
5964efa262 fix: do not allow overwriting the mapstructure output
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 18:31:41 +02:00
Mark Sagi-Kazar
7dbe493dd1 fix: do not allow setting dependencies to nil values
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 18:23:40 +02:00
Mark Sagi-Kazar
ee6cffa48d feat(encoding): drop HCL, Java properties and INI dependencies
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 17:19:23 +02:00
Mark Sagi-Kazar
7f90845afc feat(encoding): use new codec registry
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 17:19:23 +02:00
Mark Sagi-Kazar
8492c8d451 refactor(encoding): rename new codec registries
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 14:58:53 +02:00
Mark Sagi-Kazar
a7f64b7f25 refactor(encoding): drop old codec registries
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 14:58:53 +02:00
Mark Sagi-Kazar
29a215ca4e feat(encoding): return an error when no codec is found
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 14:58:53 +02:00
Mark Sagi-Kazar
3a285e0226 feat(encoding): expose new encoding layer
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 14:58:53 +02:00
Mark Sagi-Kazar
d1e18b2551 feat: add experimental flag for bind struct
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-05 13:35:34 +02:00
Mark Sagi-Kazar
3640bcdc46 feat: allow setting options on the global viper instance
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-05 13:32:50 +02:00
Mark Sagi-Kazar
a42c1b9f76 feat: return error when no config type is set
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-05 13:29:04 +02:00
Mark Sagi-Kazar
b206f2075e feat: control finder behavior by experimental feature flag
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 21:01:12 +02:00
Mark Sagi-Kazar
2636060878 feat: add experimental finder option
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 21:01:12 +02:00
Mark Sagi-Kazar
1be81c313a feat: do not return early from old search functions
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 13:39:13 +02:00
Mark Sagi-Kazar
f452b09dd9 feat: add finder
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 13:39:13 +02:00
Mark Sagi-Kazar
272344e426 refactor: move remote code to separate file
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-02 12:22:28 +02:00
Mark Sagi-Kazar
7f90580059 refactor: drop slog shim
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-02 11:53:32 +02:00
Mark Sagi-Kazar
5ce200a311 fix: add back weak string slice hook
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-02 11:00:05 +02:00
Mark Sagi-Kazar
c019486d56 chore: update mapstructure
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-02 11:00:05 +02:00
Stephen Kitt
abea773f16 Update references to bketelsen/crypt
Since https://github.com/spf13/viper/pull/1218 crypt is provided by
https://github.com/sagikazarmark/crypt

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-05-29 16:02:38 +02: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
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