Sha256: e610dc7c7a71003c054c3a862ae07f6e6d8f10c7cb881d83aa595bc356a7b318

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

module Pesapal

  class Railtie < Rails::Railtie

    initializer 'pesapal.load_credentials' do

      path_to_yaml = "#{Rails.root}/config/pesapal.yml"
      if File.exist?(path_to_yaml)
        begin
          config.pesapal_credentials = YAML::load(IO.read(path_to_yaml))[Rails.env]
        rescue Errno::ENOENT
          logger.info('YAML configuration file couldn\'t be found. Using defaults.'); return
        rescue Psych::SyntaxError
          logger.info('YAML configuration file contains invalid syntax. Will use using defaults.'); return
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pesapal-1.5.0 lib/pesapal/railtie.rb