core-cfg
v0.0.2
Published
minimalistic configuration templating
Downloads
6
Readme
core-cfg
minimalistic config templating
Install
npm install -g core-cfg
About
core-cfg installs two programms: cfg and facts.
cfg
Usage: cfg [template-dir]
Options:
-d, --destination <path> Write processed templates relative to <path> [/]
-t, --template <file> Process only <file> and write output to stdout
cfg creates configuration files from templates which are filled with data from a json object. This json object is read from stdin as context. The context is applied to all template configuration files in template-dir (or a single template file if the -t option is used). As a template language Handlebars (http://handlebarsjs.com) is used. The complete file tree (including permissions) is reproduced into the destination directory (which by default is /).
facts
Usage: facts <keys...>
Options:
-i, --stdin Read JSON from stdin
facts is a small utility to create a cfg context from a SmartOS Zone configuration.
It takes any number of keys as arguments, reads them via mdata-get and produces a JSON object which can be processed by cfg. When the -i option is used it merges the context with a JSON object read from stdin.
Examples
# echo '{"foo": "yes"}' | facts -i sdc:max_physical_memory sdc:zonename
{
"foo": "yes",
"sdc:max_physical_memory": "512",
"sdc:zonename": "9402a15e-a6a3-49c9-90a1-910c893c06ed"
}
# facts graphite_host | cfg /opt/cfg/templates/graphite/