24 lines
		
	
	
		
			526 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
		
		
			
		
	
	
			24 lines
		
	
	
		
			526 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
|   | 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 |