Move most of NetBox's configuration parameters into the database
See original GitHub issueEnvironment
- Python version: 3.7.9
- NetBox version: 2.10.5
Proposed Functionality
Currently, NetBox stores its configuration in (wait for it) configuration.py
, as a set of Python variables that get loaded at start time. This FR proposes moving most of this configuration into the database, perhaps as a monolithic JSON object. Critical configuration parameters, such as database and Redis details, would stay in configuration.py
.
Use Case
There are a few benefits to this approach. First, it would allow us to provide a convenient UI and API for managing configuration settings. (Arguably that could also be done with a flat file, but using the database simplifies things quite a bit.)
It would also make highly available deployments a bit easier, as the configuration would be synchronized among nodes automatically, without having to set up a separate process to replication the configuration file.
Finally, it could also afford us the ability to store configuration revisions (if we store every configuration as a snapshot). Users could easily make a change, and then revert to a previous configuration if it goes wrong.
Database Changes
We’d probably create a ConfigurationRevision
class or something to that effect. It would be a standard model, but might include a bit of additional logic for managing.
External Dependencies
The django-constance library is worth checking out, though it might be overkill.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:6 (5 by maintainers)
Top GitHub Comments
The delineation here will be between native Django settings and configuration parameters that we’ve introduced for NetBox specifically. By moving the later out of the settings module, we’ll be able to update them dynamically without needing to restart any services.