Sha256: 00dae83feeab7cc48d36556fa6e2ea780a9ea412e73e16fb290c20b7cb58c0d7

Contents?: true

Size: 635 Bytes

Versions: 5

Compression:

Stored size: 635 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
      @webview = nil
    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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ultra_settings-2.0.0 lib/ultra_settings/rack_app.rb
ultra_settings-1.1.2 lib/ultra_settings/rack_app.rb
ultra_settings-1.1.1 lib/ultra_settings/rack_app.rb
ultra_settings-1.1.0 lib/ultra_settings/rack_app.rb
ultra_settings-1.0.1 lib/ultra_settings/rack_app.rb