Module: DotenvHelper
- Defined in:
- lib/arkana/helpers/dotenv_helper.rb
Overview
This helper is a mere utility used to facilitate and orchestrate the loading of multiple Dotenv files.
Class Method Summary collapse
- .flavor_dotenv_filepath(config) ⇒ Object
-
.load(config) ⇒ Object
Loads the appropriate dotenv file(s).
Class Method Details
.flavor_dotenv_filepath(config) ⇒ Object
14 15 16 17 18 |
# File 'lib/arkana/helpers/dotenv_helper.rb', line 14 def self.flavor_dotenv_filepath(config) dotenv_dirname = File.dirname(config.dotenv_filepath) flavor_dotenv_filename = ".env.#{config.current_flavor.downcase}" File.join(dotenv_dirname, flavor_dotenv_filename) end |
.load(config) ⇒ Object
Loads the appropriate dotenv file(s).
8 9 10 11 12 |
# File 'lib/arkana/helpers/dotenv_helper.rb', line 8 def self.load(config) Dotenv.load(config.dotenv_filepath) if config.dotenv_filepath # Must be loaded after loading the `config.dotenv_filepath` so they override each other in the right order Dotenv.load(flavor_dotenv_filepath(config)) if config.current_flavor end |