Full Layering

The Basic layering docs focuses on providing a gentle introduction to layering. This document covers layering in more detail.

Stick to a Few

Since layering is so powerful, you want to choose a few layers that make sense for your team and stick to them. Here’s an example:

Vars

config/blueprints/demo/vars/base.rb
config/blueprints/demo/vars/dev.rb

Params

config/blueprints/demo/params/base.env
config/blueprints/demo/params/dev.env

Shown as a tree:

config/blueprints/demo
├── params
│   ├── base.env
│   └── dev.env
└── vars
    ├── base.rb
    └── dev.rb

Seeing Layers Clearly

To see the layers being used, use the config.layering.show option.

config/app.rb

Lono.configure do |config|
  config.layering.show = true
end

With that turned on, you’ll see the found layers that will be used:

$ lono build demo
Building template
    config/blueprints/demo/vars/base.rb
    config/blueprints/demo/vars/dev.rb
    output/demo/template.yml
Building parameters
    config/blueprints/demo/params/base.env
    config/blueprints/demo/params/dev.env
    output/demo/params.json

This will only show found layers, which is what you want to see most of the time. To see all possible layers, see: Debugging Layering Docs.