Use special ninja powers to manage system configurations 🥷
Project description
Config Ninja 🥷
Similar to confd
, manage your system configuration files by populating Jinja2 templates with data from a remote provider.
Installation
Install all available backends with pip
(or choose a specific one):
pip install 'config-ninja[all]'
Then, install the config-ninja
agent for the current user:
# omit '--user' to install the agent at the system level
config-ninja self install --user
How It Works
To demonstrate how the mechanics work locally:
- create a settings file for
config-ninja
:cat <<EOF >config-ninja-settings.yaml CONFIG_NINJA_OBJECTS: example-0: dest: format: json path: ./.local/settings.json source: backend: local format: toml init: kwargs: path: ./.local/config.toml EOF
- start
config-ninja
inmonitor
mode:config-ninja monitor
- in a separate shell, create the
config.toml
:cat <<EOF >./.local/config.toml [example-0] a = "first value" b = "second value EOF
- inspect the generated
settings.json
:cat ./.local/settings.json
{ "example-0": { "a": "first value", "b": "second value" } }
- Make changes to the data in
config.toml
, andconfig-ninja
will updatesettings.json
accordingly:cat <<EOF >>./.local/config.toml [example-1] c = "third value" d = "fourth value EOF cat ./.local/settings.json
{ "example-0": { "a": "first value", "b": "second value" }, "example-1": { "1": "third value", "2": "fourth value" } }
Chances are, you'll want to update theconfig-ninja-settings.yaml
file to use a remote backend (instead oflocal
). See config_ninja.contrib for a list of supported config providers.
Configuration Architecture
The config-ninja
agent monitors the backend source for changes. When the source data is changed, the agent updates the local configuration file with the new data:
sequenceDiagram
loop polling
config-ninja->>backend: query for changes
end
backend->>+config-ninja: [backend changed] fetch config
config-ninja->>-filesystem: write updated configuration file
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
config_ninja-1.0.0.tar.gz
(26.0 kB
view hashes)
Built Distribution
Close
Hashes for config_ninja-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35cbdda74efb7e7a742e526b227f5ac5eb5207b27b2d9e801d9e3a9faebbf637 |
|
MD5 | 38869012ff23c57c4b08ddc4edb4bc46 |
|
BLAKE2b-256 | 21e098272fe447167118418bc663a220229d9b63dfd2d40101711b2cf45bee41 |