forked from ManageIQ/depot.manageiq.org
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrollout.rb
More file actions
executable file
·34 lines (27 loc) · 857 Bytes
/
Copy pathrollout.rb
File metadata and controls
executable file
·34 lines (27 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def Object.const_missing(const)
if const == :ROLLOUT
require 'redis'
redis_url = ENV.fetch("REDIS_URL", "redis://127.0.0.1:6379")
#redis_connect = {}.tap { |h| h[:host] = ENV["REDIS_HOST"] if ENV["REDIS_HOST"] }
redis = Redis.new(:url => "#{redis_url}/1")
Object.const_set('ROLLOUT', Rollout.new(redis))
features = ENV['FEATURES'].to_s.split(',')
#
# Features that are defined in rollout but are no longer defined
# in ENV['FEATURES'] need to be deactivated.
#
(ROLLOUT.features - features).each do |feature|
ROLLOUT.deactivate(feature)
end
#
# Features that are defined in ENV['FEATURES'] but are
# not defined in rollout need to be activated.
#
(features - ROLLOUT.features).each do |feature|
ROLLOUT.activate(feature)
end
ROLLOUT
else
super
end
end