outsource configuration to external module

This commit is contained in:
rofl0r
2019-01-05 03:47:03 +00:00
parent 05294186d4
commit ffbe450aee
3 changed files with 41 additions and 36 deletions

21
config.py Normal file
View File

@@ -0,0 +1,21 @@
from ConfigParser import SafeConfigParser
_loaded = False
def load():
if _loaded: return
global database, maxfail, search, torhosts, watchd_threads, checktime, timeout, read_timeout
## read the config files
parser = SafeConfigParser()
parser.read('config.ini')
database = parser.get('global', 'database')
maxfail = parser.getint('global', 'proxy_max_fail')
search = parser.getboolean('proxyfind', 'search')
torhosts = [ str(i).strip() for i in parser.get('global', 'tor_host').split(',') ]
watchd_threads = parser.getint('watcherd', 'threads')
timeout = parser.getint('watcherd', 'timeout')