Support for JSON and YAML configuration files #1180
Replies: 5 comments 1 reply
-
Netbox itself is using Python files for the configuration. I don't think it's a good idea to rewrite this system in the Docker image. You can mount configuration files as ConfigMaps and populate those directly from Python files. See |
Beta Was this translation helpful? Give feedback.
-
We cannot leverage Helm deep merge with I considered using I understand your point of view about this FR being for Netbox more than netbox-docker. I don't think it will be accepted though. |
Beta Was this translation helpful? Give feedback.
-
I believe the following should work just fine: |
Beta Was this translation helpful? Give feedback.
-
That's what I do already. Wanted to propose it so the community can benefit from it. Was also interested in people feedback on how they handle such case. |
Beta Was this translation helpful? Give feedback.
-
That's kind of you. It seems like this could become a Wiki page for those interested. Or you could ask whether the netbox-chart project of @bootc is interested in such a contribution. From a maintainer's perspective, we'd rather not add more custom functionality to the image itself. The reason is that we have to maintain the feature and test it with every release (our releases, and releases of NetBox). We're not keen on committing to more work. (It's why we extracted the initializers to become their own plugin, for example.) |
Beta Was this translation helpful? Give feedback.
-
Desired Behavior
.json
and/or.yaml
/.yml
files in/etc/netbox/config/
are loaded and used for configuration (in addition of Python files).Contrast to Current Behavior
Only python is supported to define configuration.
Required Changes
Add support for other file suffixes in
/docker/configuration.docker.py
.Discussion: Benefits and Drawbacks
If you use templating tools like Helm to manage netbox configuration, templating Python files can be tricky with nested dicts (
PLUGINS_CONFIG
is the main use case). yaml and json resolve booleans totrue
/false
, while a valid Python boolean isTrue
/False
(capitalized), so we cannot just convert some conf to json. Also, it is pretty hard to handle unquoted booleans, lists and dicts, while keeping strings quoted. Covering all cases in Helm was a huge pain.Benefits:
/etc/netbox/config
, then it may breakDrawbacks:
extra.py
file.I don't know if other people have such use case, or if I just do it wrong. It's an open discussion. If this feature is accepted, I can submit a PR.
Beta Was this translation helpful? Give feedback.
All reactions