Sha256: f57fef633c4444a32dead2dd9d26452538ad6778df6734ef91fac5340630dbd3

Contents?: true

Size: 877 Bytes

Versions: 18

Compression:

Stored size: 877 Bytes

Contents

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

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

adapter = Flipper::Adapters::Instrumented.new(
  Flipper::Adapters::PStore.new,
  instrumenter: ActiveSupport::Notifications,
)
flipper = Flipper.new(adapter)

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

# You can uncomment this to get some default data:
# flipper[:logging].enable_percentage_of_time 5

use Rack::Reloader

run Flipper::Api.app(flipper) { |builder|
  builder.use Flipper::Middleware::SetupEnv, flipper
  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/custom_memoized.ru
flipper-1.3.1 examples/api/custom_memoized.ru
flipper-1.3.0 examples/api/custom_memoized.ru
flipper-1.3.0.pre examples/api/custom_memoized.ru
flipper-1.2.2 examples/api/custom_memoized.ru
flipper-1.2.1 examples/api/custom_memoized.ru
flipper-1.2.0 examples/api/custom_memoized.ru
flipper-1.1.2 examples/api/custom_memoized.ru
flipper-1.1.1 examples/api/custom_memoized.ru
flipper-1.1.0 examples/api/custom_memoized.ru
flipper-1.0.0 examples/api/custom_memoized.ru
flipper-1.0.0.pre examples/api/custom_memoized.ru
flipper-0.28.3 examples/api/custom_memoized.ru
flipper-0.28.2 examples/api/custom_memoized.ru
flipper-0.28.1 examples/api/custom_memoized.ru
flipper-0.28.0 examples/api/custom_memoized.ru
flipper-0.27.1 examples/api/custom_memoized.ru
flipper-0.27.0 examples/api/custom_memoized.ru