Sha256: 25117d51ac9fc836cf3ee90a8349853de6a87121f233e78685b329b9ec30a212

Contents?: true

Size: 718 Bytes

Versions: 9

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

module UltraSettings
  # Rack application for displaying the current settings in an HTML page.
  # No setting values are displayed, but you should still add some
  # sort of authentication if you want to use this in production.
  class RackApp
    def initialize(color_scheme: nil)
      @webview = nil
      @color_scheme = color_scheme
    end

    def call(env)
      [200, {"content-type" => "text/html; charset=utf8"}, [webview.render_settings]]
    end

    private

    def webview
      if ENV.fetch("RAILS_ENV", ENV.fetch("RACK_ENV", "development")) == "development"
        @webview = nil
      end
      @webview ||= WebView.new(color_scheme: @color_scheme)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ultra_settings-2.4.5 lib/ultra_settings/rack_app.rb
ultra_settings-2.4.4 lib/ultra_settings/rack_app.rb
ultra_settings-2.4.3 lib/ultra_settings/rack_app.rb
ultra_settings-2.4.2 lib/ultra_settings/rack_app.rb
ultra_settings-2.4.1 lib/ultra_settings/rack_app.rb
ultra_settings-2.4.0 lib/ultra_settings/rack_app.rb
ultra_settings-2.3.0 lib/ultra_settings/rack_app.rb
ultra_settings-2.2.0 lib/ultra_settings/rack_app.rb
ultra_settings-2.1.0 lib/ultra_settings/rack_app.rb