Commit graph

296 commits

Author SHA1 Message Date
maxime mouial
c3db1c77f1
Fix Viper 'UnmarshalKey' behavior to include all sources (#32)
Fix Viper 'UnmarshalKey' behavior to include all sources

Viper 'UnmarshalKey' seems to have been designed to work on leaf
settings only. When being called on a group of settings, it would not
merge all sources (default, env vars, config, override, ...).

This means that using the `Set()` method could change the returned value
from 'UnmarshalKey' in unexpected ways (i.e. would no longer return the
value from the configuration).
2024-04-22 14:54:57 +02:00
Pierre Gimalac
3e7837fd38
Merge pull request #31 from DataDog/pgimalac/is-known 2024-03-11 12:05:42 +01:00
Pierre Gimalac
436e036a76
feat: add IsKnown function on viper config 2024-03-07 15:57:07 +01:00
Pierre Gimalac
1d9194ffab
Merge pull request #30 from DataDog/osfm-workflow-fix
Open Source Fork Monitor allowlist
2023-09-29 15:16:43 +02:00
datadog-datadog-prod-us1[bot]
7dddee6206
[Datadog Workflows] create/update file 2023-09-29 03:39:52 +00:00
Dustin J. Mitchell
894f903045
Merge pull request #26 from DataDog/dustin.mitchell/asc-158
return permissions errors when opening config files
2022-09-02 13:28:03 -04:00
Dustin J. Mitchell
2801bd7202
update golang.org/x/sys for newer Go versions 2022-09-02 16:54:09 +00:00
Dustin J. Mitchell
e6afa04a3a
remove debugging line 2022-09-02 14:49:46 +00:00
Dustin J. Mitchell
1377bd5bd2
update Go versions to the versions used in datadog-agent 2022-08-30 16:02:05 +00:00
Dustin J. Mitchell
f52b169536
return permissions errors when opening config files 2022-08-29 20:13:33 +00:00
Srdjan Grubor
cc79e93841
Merge pull request #25 from DataDog/sgnn7/add-codeowners-file
[CODEOWNERS] Add @DataDog/agent-shared-components as codeowners
2022-08-16 08:26:38 -05:00
Srdjan Grubor
f05b1fd2e8
[CODEOWNERS] Add @DataDog/agent-shared-components as codeowners
Since this repo is owned by the whole team, any changes should ping all members
of this team for reviews.
2022-08-15 16:31:29 -05:00
maxime mouial
bd499f9c47
Merge pull request #24 from DataDog/maxime/add-all-settings-without-default
Add a AllSettingsWithoutDefault method
2022-07-13 14:25:48 +02:00
Maxime mouial
3801ce6375
Add a AllSettingsWithoutDefault method
We want the ability to pull the entire configuration without the default
to know what a user explicitly configured
2022-07-13 14:13:16 +02:00
Pablo Baeyens
7e5da050b1
Revert "Make AllKeys and AllSettings return set-but-empty keys" (#22) 2022-05-31 10:49:08 +02:00
Albert Vaca Cintora
86d951dc13
Merge pull request #21 from DataDog/albertvaka/viper-fixes-subset
Make AllKeys and AllSettings return set-but-empty keys
Add Unset method
2022-05-10 11:30:13 +02:00
Albert Vaca Cintora
0b35ab4493 Add Unset method
Before, we would set entries to nil to unset them
2022-05-09 15:59:10 +02:00
Albert Vaca Cintora
da54697d46 Exclude keys bound to env from AllKeys/AllSettings unless env var is set 2022-05-09 15:09:51 +02:00
Albert Vaca Cintora
dd14d2c73f Also consider explicitly set empty dicts as leaf nodes 2022-04-20 12:44:39 +02:00
Albert Vaca Cintora
42406af567 Make AllSettings include set-but-empty keys 2022-04-20 12:38:20 +02:00
Olivier Vielpeau
1cc3fa065c
Merge pull request #19 from ganeshkumarsv/master
Setting up codescanning for viper
2022-02-17 18:16:57 +01:00
ganeshkumarsv
b1a41be4ef
Create codeql-analysis.yml 2022-01-04 12:32:44 -05:00
Dustin J. Mitchell
8e7459bcf3
Merge pull request #17 from DataDog/dustin.mitchell/add-ci
Copy CI workflows from `spf13/viper` repo
2021-07-20 11:29:30 -04:00
Dustin Mitchell
e39974a917
remove unused .travis.yml 2021-07-20 11:00:54 -04:00
Dustin Mitchell
de261e11d0
Copy CI workflows from spf13/viper repo
This imports the `ci` workflow from
ab4b05adc6
with one modification noted in the file.

This omits the feedback workflows, as those are not required here.  It
also omits the wasm workflow, as this old snapshot of the code does not
work in that context.
2021-07-20 09:41:35 -04:00
Kyle Nusbaum
af23aee54e
viper: support building on AIX (#15)
This commit removes the config watch feature of the library when building
on AIX. The fsnotify dependency required for this feature does not
currently compile on AIX, and we no not currently need this feature on AIX.
2020-11-12 17:14:41 -06:00
Kyle Nusbaum
7622869718 fix formatting 2020-11-11 12:28:51 -06:00
Kyle Nusbaum
943b9e6a36 viper: support building on AIX
This commit removes the config watch feature of the library when building
on AIX. The fsnotify dependency required for this feature does not
currently compile on AIX, and we no not currently need this feature on AIX.
2020-11-11 11:26:47 -06:00
Gabriel Aszalos
4ee0750c91
Allow setting multiple environment variables for the same key. (#14)
* Allow setting more than one env. variable into BindEnv.
* Allow setting value transformers which permit the modification of
an environment variable before being assigned to a key.
2020-09-14 11:27:04 +03:00
Cody Lee
fa4e03eaf5
Merge pull request #13 from DataDog/define-custom-install
define custom install to make go modules work
2020-02-27 10:44:43 -06:00
Cody Lee
bf41424e1c
add back go.sum 2020-02-27 10:38:11 -06:00
MRHwick
940e2f6b82 move travis diff call to before vendoring 2020-02-27 11:28:17 -05:00
Matthew Hardwick
8a855103ac
try excluding vendor from gofmt 2020-02-27 11:18:38 -05:00
Matthew Hardwick
7d500a2af3
bump patch for etcd
https://github.com/etcd-io/etcd/issues/11475
2020-02-27 10:51:42 -05:00
Matthew Hardwick
2922e4434f
Try fixing go.mod problem from ugorji/go/codec
https://github.com/ugorji/go/issues/299
https://github.com/ugorji/go/issues/318
https://github.com/ugorji/go/pull/319
2020-02-27 10:30:37 -05:00
Matthew Hardwick
31f45ebfd6
try build with -mod=readonly for test command 2020-02-27 09:59:02 -05:00
Cody Lee
146f689044
start the script by vendoring first 2020-02-26 17:07:36 -06:00
Cody Lee
713af2cac4
hacks from other travis users 2020-02-26 17:01:06 -06:00
Cody Lee
cfa0e76c89
define custom install to make go modules work 2020-02-26 16:56:56 -06:00
Cody Lee
6163a31d56
Merge pull request #12 from DataDog/go-mod-fix
Go modules fix
2020-02-26 16:45:49 -06:00
Cody Lee
69031d4075
bump to 1.14 2020-02-26 16:44:40 -06:00
Cody Lee
a4cbd30fbd
fix travis.yml so build actually works 2020-02-26 16:36:08 -06:00
Cody Lee
5b85211713
fix go.mod module definition to use the correct path
run `go mod tidy`
2020-02-26 16:23:04 -06:00
Albert Vaca
0d6ea091c7
Merge pull request #7 from DataDog/albertvaka/poc-config-schema
Enable storing a set of known valid config keys
2019-04-23 17:53:20 +02:00
Albert Vaca
e528ca4ad4
Merge pull request #8 from DataDog/albertvaka/tests-avoid-globals
Make tests independent from each other
2019-04-23 15:25:53 +02:00
Albert Vaca
e98778d4ec Make tests independent from each other
By creating a new Viper for each test instead of using the global one
2019-04-23 13:24:20 +02:00
Albert Vaca
e8b3270767 Added test for known keys 2019-04-23 12:40:40 +02:00
Albert Vaca
ead7a65a23 Added missing global versions of SetKnown/GetKnown
For consistency
2019-04-23 12:40:19 +02:00
Albert Vaca
73fad7c9db Enable storing a set of known valid config keys
This can be used to enforce a config schema
2019-03-29 19:08:07 +01:00
Albert Vaca
991b92b30e
Merge pull request #5 from DataDog/albertvaka/warn-duplicate-keys-no-rebased
Warn when a yaml file has duplicated keys
2019-03-29 18:05:23 +01:00