Class: Sequelizer::EnvConfig
- Inherits:
-
Object
- Object
- Sequelizer::EnvConfig
- Defined in:
- lib/sequelizer/env_config.rb
Overview
Creates a set of database configuration options from environment variables
Instance Method Summary collapse
-
#options ⇒ Object
Any environment variables in the .env file are loaded and then any environment variable starting with SEQUELIZER_ will be used as an option for the database.
Instance Method Details
#options ⇒ Object
Any environment variables in the .env file are loaded and then any environment variable starting with SEQUELIZER_ will be used as an option for the database
10 11 12 13 14 15 16 17 18 |
# File 'lib/sequelizer/env_config.rb', line 10 def Dotenv.load env_config = ENV.keys.select { |key| key =~ /^SEQUELIZER_/ }.inject({}) do |config, key| new_key = key.gsub(/^SEQUELIZER_/, '').downcase config[new_key] = ENV[key] config end env_config.empty? ? nil : env_config end |