2015-07-16 12:54:16 +03:00
|
|
|
require "db/mongo/mongo_connector"
|
|
|
|
|
|
2015-02-06 17:21:13 +03:00
|
|
|
module Devops
|
|
|
|
|
class Db
|
|
|
|
|
|
|
|
|
|
@@db = nil
|
|
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
def init
|
|
|
|
|
config = DevopsConfig.config
|
|
|
|
|
mongo_db = config[:mongo_db] || "devops"
|
|
|
|
|
mongo_host = config[:mongo_host] || "localhost"
|
|
|
|
|
mongo_port = config[:mongo_port] || 27017
|
|
|
|
|
mongo_user = config[:mongo_user]
|
|
|
|
|
mongo_password = config[:mongo_password]
|
|
|
|
|
@@db = MongoConnector.new(mongo_db, mongo_host, mongo_port, mongo_user, mongo_password)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def connector
|
|
|
|
|
@@db
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|