Wiki

Clone wiki

config-tool / Home

config-tool

config-tool is a simple configuration management tool for JSON files. This tool allows the user to easily read, write and validate a JSON file from command line as well as from a python script which imports the Config class.

Usage

From the commandline

Given a configuration file (sample.json):

{
    "foo":{
        "bar":1
    }
}

We can create a shell script (reader.sh) like this:

#!/bin/bash
foo_bar="$(config --read --key foo.bar --config ./sample.json)"
echo "foo.bar:$foo_bar"

Executing this script will return this:

root# reader.sh
foo.bar:1

From an application's source code

discussion needed.

#!python
#code sample needed

Updated