Sha256: d8abe046f3ac0124375b57cb680f9e6258cbf41670bd6089b75f44e17db690f4

Contents?: true

Size: 973 Bytes

Versions: 17

Compression:

Stored size: 973 Bytes

Contents

#
# Usage:
#   # if you want it to not reload and be really fast
#   bin/rackup examples/api/custom_memoized.ru -p 9999
#
#   # if you want reloading
#   bin/shotgun examples/api/custom_memoized.ru -p 9999
#
#   http://localhost:9999/
#

require 'bundler/setup'
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

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
flipper-0.26.2 examples/api/custom_memoized.ru
flipper-0.26.1 examples/api/custom_memoized.ru
flipper-0.26.0 examples/api/custom_memoized.ru
flipper-0.26.0.rc2 examples/api/custom_memoized.ru
flipper-0.26.0.rc1 examples/api/custom_memoized.ru
flipper-0.25.4 examples/api/custom_memoized.ru
flipper-0.25.3 examples/api/custom_memoized.ru
flipper-0.25.2 examples/api/custom_memoized.ru
flipper-0.25.1 examples/api/custom_memoized.ru
flipper-0.25.0 examples/api/custom_memoized.ru
flipper-0.24.1 examples/api/custom_memoized.ru
flipper-0.24.0 examples/api/custom_memoized.ru
flipper-0.23.1 examples/api/custom_memoized.ru
flipper-0.23.0 examples/api/custom_memoized.ru
flipper-0.22.2 examples/api/custom_memoized.ru
flipper-0.22.1 examples/api/custom_memoized.ru
flipper-0.22.0 examples/api/custom_memoized.ru