Commit a0a983a
authored
Use json-iterator for secrets marshalling (#44309)
### What does this PR do?
Use json-iterator for secrets marshalling in the file `comp/core/secrets/impl/fetch_secret.go`
### Motivation
If my `datadog.yaml config` contains this:
```
secret_backend_command: /opt/datadog-agent/scripts/script.py
secret_backend_type: aws.secrets
secret_backend_config:
a:
b: c
api_key: ENC[my_api_key]
```
Then running this code with `DD_CONF_NODETREEMODEL=enable` leads to `b: c` having type `map[interface{}]interface{}` which `encoding/json` fails to marshal. The third-party package `"github.com/json-iterator/go"` will correctly marshal this.
### Describe how you validated your changes
### Additional Notes
It's unclear why enabling NTM causes this different runtime type. It could be a good idea to make sure the yaml reader never returns objects of type `map[interface{}]interface{}`.
Co-authored-by: dustin.long <dustin.long@datadoghq.com>1 parent 19a6b24 commit a0a983a
File tree
5 files changed
+36
-1
lines changed- comp/core/secrets
- fx
- impl
5 files changed
+36
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments