netbox-docker
netbox-docker copied to clipboard
Remove hardcoded configurations
Related Issue:
New Behavior
All of the Dynamic Configuration Settings are available out of the box.
Contrast to Current Behavior
Only a few DCS' were available. To use them, one had to modify configuration.py
Discussion: Benefits and Drawbacks
This allows users to utilize the awesomeness that is DCS
Changes to the Wiki
Proposed Release Note Entry
Enable the user of Dynamic Configuration Settings out of the box
Double Check
- [x] I have read the comments and followed the PR template.
- [x] I have explained my PR according to the information in the comments.
- [x] My PR targets the
develop
branch.
I'm unsure if removing them is the right way. People may rely on these settings being configurable via environment variables. Perhaps a better way forward would be to check whether the relevant env variable exists, and only if it does, then set the variable:
# …
if 'BANNER_TOP' in environ:
BANNER_TOP = environ.get('BANNER_TOP', '')
if 'BANNER_BOTTOM' in environ:
BANNER_BOTTOM = environ.get('BANNER_BOTTOM', '')
# …
Would that also suit the purpose, @benwa?
Would perhaps replacing the default value ''
with None
for the relevant variables work already? Like this:
BANNER_TOP = environ.get('BANNER_TOP', None)
BANNER_BOTTOM = environ.get('BANNER_BOTTOM', None)
Would perhaps replacing the default value
''
withNone
for the relevant variables work already? Like this:BANNER_TOP = environ.get('BANNER_TOP', None) BANNER_BOTTOM = environ.get('BANNER_BOTTOM', None)
This won't work because then those variables are set in the settings object and found when the dynamic configuration is loaded. Only when the variables are not set at all they are pulled from the dynamic configuration (see here, this works in a similar way to our configuration.docker.py
.).
So the working implementation is from your previous comment.
Obsoleted by #857