No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2019-04-28 08:39:49 +00:00
.gitlab-ci.yml Basic unit testing 2018-08-29 20:54:15 +00:00
CHANGELOG.md Updated changelog 2019-01-03 18:07:55 +01:00
helpers.go Fix formatting 2019-04-28 10:36:56 +02:00
LICENSE Initial commit 2018-06-10 23:57:51 +02:00
main.go Only output missing keys 2018-06-11 21:18:00 +02:00
README.md Update documentation regarding merge behavior after meta-config update. 2019-04-27 19:49:18 +02:00
vars.go Fix formatting 2019-04-28 10:36:56 +02:00
vars_test.go Fix formatting 2019-04-28 10:36:56 +02:00

config-management is a simple utility, that helps you setup templated stuff.

Setup

You can either download a pre-compiled binary or build the binary yourself.

Installation with precompiled binary

  1. Go to the list of pipelines of config-management. Look for the pipeline corresponding to your desired version, e. g. version 1.1.0.

  2. Click on the "compile" job.

  3. Click "download" below "Build artifacts".

Manual setup

  1. Install Go.

  2. Clone the code

    $ git clone https://dev.cryptec.at/david/config-management.git
    
  3. Build config-management:

    $ go build
    
  4. Copy config-management to your $PATH.

    $ cp config-management ~/bin
    

Usage by example

Create a file meta-config.yml containing this:

vars:
    ducks: 7
    swans:
        default: 2
        comment: Amount of swans in the pool
files:
    story.template: story.txt

Execute

$ config-management generate-template

to receive a fresh configuration full of default values on stdout:

ducks: 7
swans: 2

Put this into config.yml. Write a touching story to story.template such as:

Once there were {{ .ducks }} ducks in a pond. Then there came {{ .swans }} swans and they lived happily ever after.

Finally run

$ config-management

to get a nice story in story.txt:

Once there were 7 ducks in a pond. Then there came 2 swans and they lived happily ever after.

What if we wanted to add a new variable? That need will arise soon enough:

Once there were {{ .ducks }} ducks in a pond. Then there came {{ .swans }} swans and they lived happily ever after.
Then {{ .ostriches }} ostriches entered the scene. They could not swim well. At all.

Edit your meta-config.yml like this:

vars:
    ducks: 7
    swans:
        default: 2
        comment: Amount of swans in the pool
    ostriches: 3
files:
    story.template: story.txt

If you run

$ config-management generate-template

Now, it will merge the existing configuration with the updated `meta-config.yml. You can just replace your existing config.