Class: CruFlags::Railtie
- Inherits:
-
Rails::Railtie
- Object
- Rails::Railtie
- CruFlags::Railtie
- Defined in:
- lib/cru_flags/railtie.rb
Overview
Zero-config Rails wiring (design doc §5.1). Registration is ordering-safe because Flipper's engine resolves config.adapter LAZILY on first Flipper.instance access, and the last-registered adapter block wins — an app's own Flipper.configure in config/initializers still overrides ours.
Class Method Summary collapse
-
.quiet_strict?(current:, env_var:, rails_env:) ⇒ Boolean
Flipper's engine assigns config.flipper.strict in before_configuration (:warn in development, false elsewhere) — BEFORE any gem initializer — so "did the app set it" cannot be read off the config value alone.
Class Method Details
.quiet_strict?(current:, env_var:, rails_env:) ⇒ Boolean
Flipper's engine assigns config.flipper.strict in before_configuration (:warn in development, false elsewhere) — BEFORE any gem initializer — so "did the app set it" cannot be read off the config value alone. We quiet strict only when the env var is unset AND the value still equals Flipper's own computed default. An app that explicitly sets the value its environment already defaults to is therefore indistinguishable from an app that set nothing, and gets quieted; the value is the only signal available without hooking the assignment (design doc §5.1).
29 30 31 32 33 |
# File 'lib/cru_flags/railtie.rb', line 29 def self.quiet_strict?(current:, env_var:, rails_env:) return false unless env_var.nil? flipper_default = (rails_env == "development") ? :warn : false current == flipper_default end |