Module: Flipper::Cloud
- Defined in:
- lib/flipper/cloud.rb,
lib/flipper/cloud/dsl.rb,
lib/flipper/cloud/telemetry.rb,
lib/flipper/cloud/middleware.rb,
lib/flipper/cloud/configuration.rb,
lib/flipper/cloud/message_verifier.rb,
lib/flipper/cloud/telemetry/metric.rb,
lib/flipper/cloud/telemetry/submitter.rb,
lib/flipper/cloud/telemetry/instrumenter.rb,
lib/flipper/cloud/telemetry/backoff_policy.rb,
lib/flipper/cloud/telemetry/metric_storage.rb
Defined Under Namespace
Classes: Configuration, DSL, MessageVerifier, Middleware, Telemetry
Class Method Summary collapse
- .app(flipper = nil, options = {}) {|builder| ... } ⇒ Object
-
.new(options = {}) {|configuration| ... } ⇒ Object
Public: Returns a new Flipper instance with an http adapter correctly configured for flipper cloud.
-
.set_default ⇒ Object
Private: Configure Flipper to use Cloud by default.
Class Method Details
.app(flipper = nil, options = {}) {|builder| ... } ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/flipper/cloud.rb', line 23 def self.app(flipper = nil, = {}) env_key = .fetch(:env_key, 'flipper') = .fetch(:memoizer_options, {}) app = ->(_) { [404, { Rack::CONTENT_TYPE => 'application/json'.freeze }, ['{}'.freeze]] } builder = Rack::Builder.new yield builder if block_given? builder.use Flipper::Middleware::SetupEnv, flipper, env_key: env_key builder.use Flipper::Middleware::Memoizer, .merge(env_key: env_key) builder.use Flipper::Cloud::Middleware, env_key: env_key builder.run app klass = self app = builder.to_app app.define_singleton_method(:inspect) { klass.inspect } # pretty rake routes output app end |
.new(options = {}) {|configuration| ... } ⇒ Object
Public: Returns a new Flipper instance with an http adapter correctly configured for flipper cloud.
token - The String token for the environment from the website. options - The Hash of options. See Flipper::Cloud::Configuration. block - The block that configuration will be yielded to allowing you to
customize this cloud instance and its adapter.
17 18 19 20 21 |
# File 'lib/flipper/cloud.rb', line 17 def self.new( = {}) configuration = Configuration.new() yield configuration if block_given? DSL.new(configuration) end |