Skip to main content

Use special ninja powers to manage system configurations 🥷

Project description

Config Ninja 🥷

Ruff 🎨 poe (push) pylint codecov pre-commit.ci status Checked with mypy docs: pdoc

Similar to confd, manage your system configuration files by populating Jinja2 templates with data from a remote provider.

Installation

To install using pip:

pip install config-ninja

Quick Start

To demonstrate the mechanics locally:

  1. create a settings file for config-ninja:
    cat <<EOF >config-ninja-settings.yaml
    CONFIG_NINJA_OBJECTS:
      example-0:
        dest:
          format: json
          path: ./.local/config.json
        source:
          backend: local
          format: toml
          init:
            kwargs:
              path: ./.local/config.toml
    EOF
    
  2. start config-ninja in monitor mode:
    config-ninja monitor
    
  3. in a separate shell, create the config.toml:
    cat <<EOF >./.local/config.toml
    [example-0]
    a = "first value"
    b = "second value
    EOF
    
  4. inspect the generated settings.json:
    cat settings.json
    
    {
      "example-0": {
        "a": "first value",
        "b": "second value"
      }
    }
    

Chances are, you'll want to update the config-ninja-settings.yaml file to use a remote backend (instead of local). 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


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.0b3.tar.gz (22.4 kB view hashes)

Uploaded Source

Built Distribution

config_ninja-1.0.0b3-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page