-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
Dynamic Configuration #343
Conversation
I really like the approach with the overwriting of the What might be a problem for Openshift and Kubernetes users is the placement of the configuration files. But with some changes to the loading of the config maps its possible to create the structure that is needed. volumes:
- name: volume-netbox-config
configMap:
name: netbox-config
items:
- key: configuration.py
path: config/configuration.py
- key: gunicorn_config.py
path: gunicorn_config.py
- key: ldap_config.py
path: config/ldap/ldap_config.py I tested this in Openshift 4.5. |
Your description says |
f86d0d1
to
2081bb3
Compare
@karrots Thanks, I've corrected this. I've now also added a draft text for the release notes. |
Therefore we esacpe it using the underscore character.
And add some comments to the the file that hopefully guide the user.
54366c7
to
dad0608
Compare
The code in Apart from that, it looks good. |
Which is the file `docker/configuration.docker.py` in our repo. The common code is then imported by `docker/ldap_config.docker.py`.
Good input! I've just pushed a commit that does that. Can you have another look? |
Related Issue: #318
New Behavior
All
.py
files in/etc/netbox/config
are now considered as configuration files. All users can add individual configuration files themselves. This allows to support complex variables and also new variables for which we don't yet have an 'ENV' variant implemented.The
configuration.py
file is processed first. All other files are evaluated afterwards in alphabetically. Later files overwrite the settings of previous files. If later files want to build upon the configuration of previous files, they can import them. Seeconfiguration/example.py
.The ldap configuration was moved to
/etc/netbox/config/ldap
. The ldap configuration works the same way as the regular configuration, i.e. there can be multiple files in/etc/netbox/config/ldap
, and they all get evaluated in order, beginning with theldap_config.py
file.To make things easy for our docker-compose users, the files in the repository folder
configuration/*
andconfiguration/ldap/*
are already mounted to/etc/netbox/config
(and/etc/netbox/config/ldap
, respectively). So a beginner user – who is using our docker-compose setup – must not necessarily re-compile the Docker Image to adjust complex configurations.As I was mangling with the configuration file anyway, I've aligned it with the upstream version.
Contrast to Current Behavior
Currently when users want to define custom variables in their
configuration.py
, they have to overwrite the default file. This will no longer be necessary. A second file can be placed in/etc/netbox/config
, e.g./etc/netbox/config/my_config.py
. The values in this file will then overwrite the values of the default configuration file,configuration.py
.Discussion: Benefits and Drawbacks
LDAP users have to be aware that the location of the
ldap_config.py
file changed from/etc/netbox/config/ldap_config.py
to/etc/netbox/config/ldap/ldap_config.py
.All users, who use our unchanged
docker-compose.yml
file should not need to adjust anything.See also #318 for a full discussion that lead to this PR.
Changes to the Wiki
A new wiki page should describe this new behavior, so that LDAP-, Plugin-, Remote-Auth-, NAPALM- and all the other power-users learn about the new ability.
Proposed Release Note Entry
Double Check
develop
branch.