-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config: add json tags to config structs #1309
base: master
Are you sure you want to change the base?
Conversation
thank you for sending this in, just tags are okay. I am not sure if we want to add support for json configs, I don't see a big reason to add support for json configs. |
Signed-off-by: Jakob Hahn <[email protected]>
Perfect, thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, will wait for a week or so to give time to other maintainers to take a look before we merge it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me.
Just adding the json tags won't work as it also needs custom Unmarshal functions. As the json support is not wanted? I might close the PR and do the changes in my fork :/ |
we don't mind having the JSON Unmarshal functions, it would be useful to folks using Blackbox exporter as a library and build on top of Blackbox exporter like you are doing What I meant was the full fledged support for configuring blackbox exporter via a json config file instead of YAML, in that side, will stick with YAML only. |
First step is done with the custom Unmarshal functions. I might need to add some Marshal functions as well. If wished I can also generate the json test cases during the test by converting the original yml test case to a json file. |
yes, that would be better then the duplicate config files. |
Signed-off-by: Jakob Hahn <[email protected]>
Signed-off-by: Jakob Hahn <[email protected]>
Signed-off-by: Jakob Hahn <[email protected]>
Signed-off-by: Jakob Hahn <[email protected]>
Signed-off-by: Jakob Hahn <[email protected]>
Signed-off-by: Jakob Hahn <[email protected]>
As an additional question. |
Signed-off-by: Jakob Hahn <[email protected]>
I don't think we thought about this before, this might be the default. changing the way config is Marshaled would need a little more discussion. if you want to change that marshaled, I would recommend creating an issue to discuss this with everyone, and if we agree on changing, i would prefer it to be it's own PR. |
This adds json tags to config struct fields. This is needed for us to reuse the structs in an internal kubernetes operator.
If just adding the tags is unwanted, I can also look into adding general support for json configs. We would need to add UnmarshalJSON functions like the UnmarshalYAML functions.
Used SED to add the json tags.
Closes #1308