Skip to content

Instantly share code, notes, and snippets.

@tbprojects
Created December 18, 2013 11:00
Show Gist options
  • Save tbprojects/8020541 to your computer and use it in GitHub Desktop.
Save tbprojects/8020541 to your computer and use it in GitHub Desktop.
We are using figaro for storing services api_keys and we had a problem when one developer changed application.yml and forgot to inform other developers about it (but he did update application.example.yml). As a result of this the other developer experienced "bugs" in the application. Put this file to initializers to detect mismatch between appli…
require 'yaml'
example_vars = YAML.load_file('config/application.example.yml').keys
live_vars = Rails.env.production? ? (ENV.keys & example_vars) : YAML.load_file('config/application.yml').keys
unless live_vars.sort == example_vars.sort
raise 'There is a mismatch between application.yml and application.example.yml'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment