Last active
March 12, 2020 12:49
-
-
Save guihatano/f7cf663aa23a7739e2e996d2c1b51f48 to your computer and use it in GitHub Desktop.
Use ENV on .yml files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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