Skip to content

Encrypting Nested Structures

Jeff Felchner edited this page Dec 30, 2020 · 3 revisions

One of the great things about Chamber is that it gives you both security and readability in your settings files, but there are certainly cases where you may want to obfuscate the structure of some of your settings.

If this is your use case, Chamber can handle it. Simply add the _secure_ onto the top level hash key and Chamber will work just as you'd expect.

# settings.yml

_secure_smtp:
  username: 'my_username'
  password: 'my_password'

Running chamber secure would turn this into something like:

# settings.yml

_secure_smtp: 8239f293r9283r9823r92hf9823hf9uehfksdhviwuehf923uhrehf9238

However you could still access it as:

Chamber.dig!('smtp', 'username')
# => 'my_username'
Clone this wiki locally