Sha256: cfeb980634cad60531047b871838f18e498e9df2570b7092746809c91ab908af

Contents?: true

Size: 928 Bytes

Versions: 2

Compression:

Stored size: 928 Bytes

Contents

module Moiper
  class Railtie < Rails::Railtie
    # Expose Moiper's configuration to the Rails application configuration.
    #
    #   module MyApplication
    #     class Application < Rails::Application
    #       config.moiper.sandbox = true
    #       config.moiper.token = "teste"
    #       config.moiper.key = "secret"
    #     end
    #   end
    config.moiper = Moiper

    initializer "load notification controller helper" do
      require "moiper/notification_controller_helper"
    end

    initializer "load moiper.yml file" do
      config_file = Rails.root.join("config", "moiper.yml")

      if config_file.file?
        yaml = YAML.load(File.read(config_file))[Rails.env]

        if yaml
          Moiper.configure do |config|
            config.sandbox = yaml["sandbox"]
            config.token = yaml["token"]
            config.key = yaml["key"]
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
moiper-0.1.1 lib/moiper/railtie.rb
moiper-0.1.0 lib/moiper/railtie.rb