Sha256: ded93bf0d15365de4be2169e383ee140054746cc072274b6e9e83d31854db8ad

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

#
# Usage:
#   bundle exec rackup examples/basic.ru
#   http://localhost:9292/
#
require "pp"
require "logger"
require "pathname"

root_path = Pathname(__FILE__).dirname.join("..").expand_path
lib_path  = root_path.join("lib")
$:.unshift(lib_path)

require "flipper-ui"
require "flipper-redis"

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

Flipper.register(:early_access) { |actor|
  actor.respond_to?(:early?) && actor.early?
}

# Setup logging of flipper calls.
$logger = Logger.new(STDOUT)
require "active_support/notifications"
require "flipper/instrumentation/log_subscriber"
Flipper::Instrumentation::LogSubscriber.logger = $logger

adapter = Flipper::Adapters::Redis.new(Redis.new(port: ENV["GH_REDIS_PORT"]))
flipper = Flipper.new(adapter, instrumenter: ActiveSupport::Notifications)

# You can uncomment these to get some default data:
# flipper[:search_performance_another_long_thing].enable
# flipper[:gauges_tracking].enable
# flipper[:unused].disable
# flipper[:suits].enable_actor Flipper::UI::Actor.new('1')
# flipper[:suits].enable_actor Flipper::UI::Actor.new('6')
# flipper[:secrets].enable_group :admins
# flipper[:secrets].enable_group :early_access
# flipper[:logging].enable_percentage_of_time 5
# flipper[:new_cache].enable_percentage_of_actors 15

run Flipper::UI.app(flipper, secret: "example_secret_dont_use_this")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flipper-ui-0.2.0.beta4 examples/basic.ru
flipper-ui-0.2.0.beta3 examples/basic.ru