Skip to content

Instantly share code, notes, and snippets.

@guihatano
Last active March 12, 2020 12:49
Show Gist options
  • Save guihatano/f7cf663aa23a7739e2e996d2c1b51f48 to your computer and use it in GitHub Desktop.
Save guihatano/f7cf663aa23a7739e2e996d2c1b51f48 to your computer and use it in GitHub Desktop.
Use ENV on .yml files
require 'dotenv/load'
configuration_file = File.join(File.expand_path('..', __FILE__), 'config.yml')
configuration = YAML.load(File.read(configuration_file).gsub(/\<\%.*\[\'([^\']+)\'\].*\%\>/) { ENV[$1] } )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment