Sha256: c1f02bb4c83564b253e6068a70f8015ff7eb2ae2ff8856b1efe4d47ea7301f36

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

module ReactOnRails
  def self.configure
    yield(configuration)
  end

  def self.configuration
    @configuration ||= Configuration.new(
      server_bundle_js_file: "app/assets/javascripts/generated/server.js",
      prerender: false,
      replay_console: true,
      logging_on_server: true,
      generator_function: false,
      trace: Rails.env.development?,
      server_renderer_pool_size: 1,
      server_renderer_timeout: 20)
  end

  class Configuration
    attr_accessor :server_bundle_js_file, :prerender, :replay_console, :generator_function, :trace,
                  :logging_on_server, :server_renderer_pool_size, :server_renderer_timeout

    def initialize(server_bundle_js_file: nil, prerender: nil, replay_console: nil,
                   generator_function: nil, trace: nil, logging_on_server: nil,
                   server_renderer_pool_size: nil, server_renderer_timeout: nil)
      if File.exist?(server_bundle_js_file)
        self.server_bundle_js_file = server_bundle_js_file
      else
        self.server_bundle_js_file = nil
      end

      self.prerender = prerender
      self.replay_console = replay_console
      self.logging_on_server = logging_on_server
      self.generator_function = generator_function
      self.trace = trace.nil? ? Rails.env.development? : trace

      # Server rendering:
      self.server_renderer_pool_size = server_renderer_pool_size # increase if you're on JRuby
      self.server_renderer_timeout = server_renderer_timeout # seconds
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
react_on_rails-1.0.0.pre lib/react_on_rails/configuration.rb
react_on_rails-0.1.8 lib/react_on_rails/configuration.rb
react_on_rails-0.1.7 lib/react_on_rails/configuration.rb