examples/mongo/basic.rb in flipper-mongo-0.21.0.rc1 vs examples/mongo/basic.rb in flipper-mongo-0.21.0.rc2
- old
+ new
@@ -1,24 +1,21 @@
require 'bundler/setup'
require 'logger'
+ENV["FLIPPER_MONGO_URL"] ||= "mongodb://127.0.0.1:#{ENV["MONGODB_PORT"] || 27017}"
require 'flipper/adapters/mongo'
-Mongo::Logger.logger.level = Logger::INFO
-collection = Mongo::Client.new(["127.0.0.1:#{ENV["MONGODB_PORT"] || 27017}"], :database => 'testing')['flipper']
-adapter = Flipper::Adapters::Mongo.new(collection)
-flipper = Flipper.new(adapter)
-flipper[:stats].enable
+Flipper[:stats].enable
-if flipper[:stats].enabled?
+if Flipper[:stats].enabled?
puts "Enabled!"
else
puts "Disabled!"
end
-flipper[:stats].disable
+Flipper[:stats].disable
-if flipper[:stats].enabled?
+if Flipper[:stats].enabled?
puts "Enabled!"
else
puts "Disabled!"
end