27 lines
		
	
	
		
			590 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			590 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require "db/mongo/mongo_connector"
 | |
| 
 | |
| 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)
 | |
|         @@db.create_indexes
 | |
|       end
 | |
| 
 | |
|       def connector
 | |
|         @@db
 | |
|       end
 | |
| 
 | |
|     end
 | |
|   end
 | |
| end
 | 
