module Getway
  class << self
    def getway_config
      getway_config = {}

      begin
        config = Rails.application.config_for(:configuration).symbolize_keys!
        getway_config = config[:getway].symbolize_keys!
        raise 'getway config missing' if getway_config.blank?
      rescue => ex
        raise ex if Rails.env.production?

        puts %Q{\033[33m [warning] getway config or configuration.yml missing,
                 please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
        getway_config = {}
      end
      getway_config
    end
  end
end
