Sha256: 01072b60a79e882527d2f765fdcf82c4272af4d144eb88c5c69d05214a03b102

Contents?: true

Size: 902 Bytes

Versions: 18

Compression:

Stored size: 902 Bytes

Contents

#
# Usage:
#   bin/rackup examples/api/memoized.ru -p 9999
#
#   http://localhost:9999/
#

require 'bundler/setup'
require 'rack/reloader'
require "active_support/notifications"
require "flipper/api"
require "flipper/adapters/pstore"

Flipper.configure do |config|
  config.adapter {
    Flipper::Adapters::Instrumented.new(
      Flipper::Adapters::PStore.new,
      instrumenter: ActiveSupport::Notifications,
    )
  }
end

ActiveSupport::Notifications.subscribe(/.*/, ->(*args) {
  name, start, finish, id, data = args
  case name
  when "adapter_operation.flipper"
    p data[:adapter_name] => data[:operation]
  end
})

Flipper.register(:admins) { |actor|
  actor.respond_to?(:admin?) && actor.admin?
}

# You can uncomment this to get some default data:
# Flipper.enable :logging

use Rack::Reloader

run Flipper::Api.app { |builder|
  builder.use Flipper::Middleware::Memoizer, preload: true
}

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
flipper-1.3.2 examples/api/memoized.ru
flipper-1.3.1 examples/api/memoized.ru
flipper-1.3.0 examples/api/memoized.ru
flipper-1.3.0.pre examples/api/memoized.ru
flipper-1.2.2 examples/api/memoized.ru
flipper-1.2.1 examples/api/memoized.ru
flipper-1.2.0 examples/api/memoized.ru
flipper-1.1.2 examples/api/memoized.ru
flipper-1.1.1 examples/api/memoized.ru
flipper-1.1.0 examples/api/memoized.ru
flipper-1.0.0 examples/api/memoized.ru
flipper-1.0.0.pre examples/api/memoized.ru
flipper-0.28.3 examples/api/memoized.ru
flipper-0.28.2 examples/api/memoized.ru
flipper-0.28.1 examples/api/memoized.ru
flipper-0.28.0 examples/api/memoized.ru
flipper-0.27.1 examples/api/memoized.ru
flipper-0.27.0 examples/api/memoized.ru