Commit graph

173 commits

Author SHA1 Message Date
alex.lew
864a85aada feat: copy keydelim from parent chart in viper.Sub() 2024-07-23 19:52:24 +02: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
6e630e548a feat(encoding): drop HCL, Java properties and INI
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-24 17:19:23 +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
afe3be23cb test: add failing test for reading config without a config type
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-05 13:29:04 +02:00
Mark Sagi-Kazar
e8707fde20 test: refactor read config test
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-05 13:29:04 +02:00
Mark Sagi-Kazar
676d2eb166 test: add tests for experimental finder
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 21:01:12 +02:00
Mark Sagi-Kazar
92e330ea77 test: fix test on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 21:01:12 +02:00
Mark Sagi-Kazar
d59cc8b6cd test: fix tests on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 21:01:12 +02:00
Mark Sagi-Kazar
164252315d test: fix finder tests
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 21:01:12 +02:00
Mark Sagi-Kazar
db0bbd8f97 feat: use new finder even when build tag is disabled
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-06-04 21:01:12 +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
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
030b77a720 fix: lint violations
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2024-02-15 14:19:50 +01: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
Oleksandr Redko
3a23b80b11 ci: enable test shuffle; fix tests 2023-12-06 19:03:14 +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
Oleksandr Redko
c4dcd31f68 fix: godot lint issues 2023-11-30 21:20:53 +07:00
Oleksandr Redko
b5daec6e7b test: Replace ifs with asserts to simplify tests 2023-10-14 02:12:35 +02:00
Oleksandr Redko
c292b55050 test: refactor asserts 2023-10-05 00:58:18 +02:00
Oleksandr Redko
3d006fe361 refactor: replace interface{} with any 2023-10-01 17:04:26 +02:00
Oleksandr Redko
6fdfebc843 Fix tests on Windows 2023-09-16 13:48:38 +02:00
Oleksandr Redko
4aeec5882c Remove usages of deprecated io/ioutil; simplify tests 2023-09-16 13:48:38 +02:00
Oleksandr Redko
13dbfcafff test: remove testutil.Setenv as not needed from Go 1.17 2023-09-07 13:33:21 +02:00
Oleksandr Redko
a0696bbc97 docs: fix typos in comments 2023-09-07 13:32:51 +02:00
andig
21a7fd828e
Allow ConfigParseError to unwrap (#1433)
* Allow ConfigParseError to unwrap

* wip

* Avoid pointer type
2023-05-30 12:07:27 +02:00
VOrishirne
2ee16310d0 extend viper's pflag binding to stringToInt pflag 2023-05-29 15:34:52 +02:00
Mark Sagi-Kazar
995db99714 test: fix test to actually assert something
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-04-06 11:12:29 +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
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
Andrew Richardson
5247643f02 Recurse into arrays when converting keys to lowercase
Fixes #1386

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
2022-07-12 18:10:05 +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
98c10c3c31 test(encoding): fix failing tests due to the yaml library update
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2022-01-01 18:16:38 +01:00
Mark Sagi-Kazar
35877c8f77 chore: fix lint
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-11-21 15:05:44 +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
0594522560 test: fix failing tests on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-22 20:41:33 +02:00
Mark Sagi-Kazar
14c9dc6a57 test: fix file find tests on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-22 20:41:33 +02:00
Mark Sagi-Kazar
8b7777d3c6 test(windows): skip failing tests on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-22 11:17:33 +02:00
Mark Sagi-Kazar
15c88da25c test(windows): fix watch file test
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-22 11:17:33 +02:00
Mark Sagi-Kazar
5a4e555471 test: add tests for reading config files
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-21 18:01:05 +02:00
Mark Sagi-Kazar
557c5d64e0 test: improve tests for searching files
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-09-21 18:01:05 +02:00