Sha256: efbdc007a85936889a141252eeb06bbda8641f12597aea96f85aa91f58d05b2d

Contents?: true

Size: 640 Bytes

Versions: 5

Compression:

Stored size: 640 Bytes

Contents

module Cohortly
  class Engine < Rails::Engine
    initializer "read_config" do |app|
      config_file = File.join(Rails.root, 'config', 'cohortly.yml')
      if File.exists?(config_file)
        Cohortly::Config.config.tap do |cfg|
          conf = YAML.load_file(config_file)[Rails.env]
          conf.keys.each { |k| cfg.send("#{k}=", conf[k]) }          
          Cohortly::Metric.connection Mongo::Connection.new(cfg.host, cfg.port)
          Cohortly::Metric.set_database_name cfg.database
          Cohortly::Metric.database.authenticate(cfg.username, cfg.password) if(cfg.password)
        end        
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cohortly-0.0.5 lib/cohortly/engine.rb
cohortly-0.0.4 lib/cohortly/engine.rb
cohortly-0.0.3 lib/cohortly/engine.rb
cohortly-0.0.2 lib/cohortly/engine.rb
cohortly-0.0.1 lib/cohortly/engine.rb