Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Config.txt
- ## Default timeout
- #Default_Timeout = 3
- ## Existing servers
- #Hostlist = ['1.2.3.4','127.0.0.1','123.0.0.1']
- ## Userlist
- #Userlist = ['user','user','user']
- ## Passwordlist
- #Passwordlist = ['userpegrase','userpregase','userp']
- ## Concurrent connections max
- #limit_concurrent_connection = 50
- #####################################################
- ## getConf.rb : get the parameters of the Config.txt file
- #####################################################
- require 'rubygems'
- require 'parseconfig'
- class GetValues
- @@token_hostlist = "Hostlist"
- @@token_password = "Passwordlist"
- @@token_user = "Userlist"
- def initialize(filename, tokenHost, tokenPass,tokenUser)
- @file = filename
- @@token_hostlist = tokenHost unless tokenHost == nil
- @@token_password = tokenPass unless tokenPass == nil
- @@token_user = tokenUser unless tokenUser == nil
- load
- end
- def load
- @config = ParseConfig.new(@file)
- parse
- end
- def parse
- @hostlist = @config.get_value(@@token_hostlist)
- @password = @config.get_value(@@token_password)
- @user = @config.get_value(@@token_user)
- end
- end
Add Comment
Please, Sign In to add comment