Sha256: 298654476eaff258899c76b83325063480de8c20b169e76281e73dc856c4cfef

Contents?: true

Size: 774 Bytes

Versions: 4

Compression:

Stored size: 774 Bytes

Contents

module Btspm
  class AppStartup

    def initialize(config_file_path:, environment:)
      @config_path = config_file_path
      @env = environment
    end

    def establish_env_variables_hash
      Rails.logger.info '***** Loading Environment Specific Properties *****'
      Rails.logger.info "config_file_path=#{config_path}"
      env_yaml_path = Rails.root.join(config_path) # The path to the .yml file
      env_yaml = ERB.new(env_yaml_path.read).result # Read the file and evaluate the ERB
      full_hash = YAML.load(env_yaml) # Parse the resulting YAML
      env_hash = full_hash[env]
      Rails.logger.info "ENV_PROPS has been loaded for Rails.env=#{env}"
      env_hash
    end

    private

    attr_reader :config_path, :env

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
btspm-0.0.4 lib/btspm/app_startup.rb
btspm-0.0.3 lib/btspm/app_startup.rb
btspm-0.0.2 lib/btspm/app_startup.rb
btspm-0.0.1 lib/btspm/app_startup.rb