Sha256: c91eb189d7e60795f4fcdc46284f27004ae6ac23dcc34c8c7d0df111ead79cb2

Contents?: true

Size: 822 Bytes

Versions: 5

Compression:

Stored size: 822 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)
          Cohortly::ReportMeta.connection Cohortly::Metric.connection
          Cohortly::ReportMeta.set_database_name cfg.database
        end        
      end
      Cohortly::StoredProcedures.store_procedures
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cohortly-0.0.9.1 lib/cohortly/engine.rb
cohortly-0.0.9 lib/cohortly/engine.rb
cohortly-0.0.8 lib/cohortly/engine.rb
cohortly-0.0.7 lib/cohortly/engine.rb
cohortly-0.0.6 lib/cohortly/engine.rb