markround.com

DevOps, Sound Engineering and other things of interest...

Tiller 0.7.7 and File Globals

| Comments

Thanks to a nice suggestion by kydorn in issue #18, the file datasource supports a global_values: block, so you can now create defaults per environment (and use the defaults datasource to provide a default for all environments). This is available in Tiller 0.7.7, which was just released.

This means if you have a common value that you want available to all templates (but may be different in each environment), you don’t have to repeat the definition for every template. In conjunction with the defaults datasource, it lets you do things like :

  • Use the defaults datasource to specify default values for all environments
  • Use global_values: for defaults specific to each environment
  • Optionally over-write them with local config: values on templates

There’s an example now in the README.md which demonstrates this :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data_sources: [ 'defaults','file','environment' ]
template_sources: [ 'file' ]

defaults:
  global:
    per_env: 'This is the default across all environments'

environments:

  development:
    global_values:
      per_env: 'This has been overwritten for the development environment'

    test.erb:
      target: test.txt
      config:
        per_env: 'This has again been overwritten by the local value just for this template'

  production:

    # This will get the value from the defaults module, as we don't specify a
    # per-environment or any per-template value overwriting it.
    test.erb:
      target: test.txt

Hopefully that will cut down the size of some config files, and also introduce some more flexibility to your Tiller setup. Thanks again, Kydorn, for the suggestion!

As always, please feel free to send any other ideas/suggestions/bugs my way – either through the GitHub issue tracker, email, or now through the new Gitter.im chatroom.

Comments