Sha256: 03d7937071e18c7063859bb27a99b7a72be78d28baf7d037b898f7a130324460

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

module Sunspot
  module Rails
    class <<self
      private

      def master_config(sunspot_rails_configuration)
        build_config do |config|
          config.solr.url = URI::HTTP.build(
            :host => sunspot_rails_configuration.master_hostname,
            :port => sunspot_rails_configuration.master_port,
            :path => sunspot_rails_configuration.master_path,
            :userinfo => [sunspot_rails_configuration.master_user, sunspot_rails_configuration.master_password]
          ).to_s
        end
      end

      def slave_config(sunspot_rails_configuration)
        build_config do |config|
          config.solr.url = URI::HTTP.build(
            :host => sunspot_rails_configuration.hostname,
            :port => sunspot_rails_configuration.port,
            :path => sunspot_rails_configuration.path,
            :userinfo => [sunspot_rails_configuration.user, sunspot_rails_configuration.password]
          ).to_s
        end
      end
      
      def build_config
        config = Sunspot::Configuration.build
        yield config
        config
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sunspot-rails-http-basic-auth-0.0.2 lib/sunspot-rails-http-basic-auth/sunspot/rails.rb
sunspot-rails-http-basic-auth-0.0.1 lib/sunspot-rails-http-basic-auth/sunspot/rails.rb