intro & use
101
# reasons
Procfile 101
limitations de foreman
tmux
overmind
# 101
<process type>: <command>
web: bundle exec rails server -p $PORT
worker: bundle exec rake jobs:work
"je veux lancer plusieurs services en local"
... sans utiliser docker
# backend
mélange de logs
performance
pty vs file
!debug
# global
terminal multiplexer
sessions multiples
veritable pty
equivalent à screen
# actor
tmux based
1 session par service/commande
debug friendly
user = User.first
# Check if enabled without an actor
Flipper.enabled?(:verbose_logging) # false
# Check if enabled for the given user
Flipper.enabled?(:verbose_logging, user) # false
# actor
user = User.first
# enable
Flipper.enable_actor(:verbose_logging, user)
# disable
Flipper.disable_actor(:verbose_logging, user)
# actor
# definition in the flipper initializer
Flipper.register(:admins) do |actor, context|
actor.respond_to?(:admin?) && actor.admin?
end
# feature check
user = User.where(admin: false).first # user who returns false for admin?
Flipper.enabled?(:documentation, user) # false
admin = User.where(admin: true).first # user who returns true for admin?
Flipper.enabled?(:documentation, admin) # true
# groups
# Flipper UI
# Flipper UI
Rails.application.routes.draw do
# ..
constraints CanAccessFlipperUI do
mount Flipper::UI.app(Flipper) => "/flipper"
end
# ..
end
# well, that's not Meta
class CanAccessFlipperUI
def self.matches?(request)
request.env["warden"].user&.team&.root?
end
end
# Flipper UI
#! BONUS
# define the property
must_be_21 = Flipper.property(:age).gte(21)
# enable a feature for with property as condition
Flipper.enable :night_club, must_be_21
# Under age
Flipper.enabled? :night_club, User.new(age: 18) #=> false
# Of age
Flipper.enabled? :night_club, User.new(age: 21) #=> true
# Combining
over_21 = Flipper.property(:age).gte(21)
paid = Flipper.property(:paid).eq(true)
vip = Flipper.property(:vip).eq(true)
Flipper.enable :night_club, Flipper.all(over_21, Flipper.any(paid, vip))
https://www.flippercloud.io/docs/features/expressions