- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Resolve "Merging of configuration" Closes #2 See merge request david/config-management!4 |
||
| .gitlab-ci.yml | ||
| CHANGELOG.md | ||
| helpers.go | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
| vars.go | ||
| vars_test.go | ||
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
-
Go to the list of pipelines of
config-management. Look for the pipeline corresponding to your desired version, e. g. version 1.1.0. -
Click on the "compile" job.
-
Click "download" below "Build artifacts".
Manual setup
-
Install Go.
-
Clone the code
$ git clone https://dev.cryptec.at/david/config-management.git -
Build
config-management:$ go build -
Copy
config-managementto 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.