mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
add KeyManager
This commit is contained in:
parent
2e4f2bc424
commit
6c044b010e
1 changed files with 13 additions and 0 deletions
|
@ -122,6 +122,10 @@ class Source:
|
||||||
os.path.join(d, c.get('newver'))))
|
os.path.join(d, c.get('newver'))))
|
||||||
|
|
||||||
self.max_concurrent = c.getint('max_concurrent', 20)
|
self.max_concurrent = c.getint('max_concurrent', 20)
|
||||||
|
keyfile = c.get('keyfile')
|
||||||
|
if keyfile:
|
||||||
|
keyfile = os.path.expanduser(keyfile)
|
||||||
|
self.keymanager = KeyManager(keyfile)
|
||||||
session.nv_config = config["__config__"]
|
session.nv_config = config["__config__"]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -187,3 +191,12 @@ class Source:
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Source from %r>' % self.name
|
return '<Source from %r>' % self.name
|
||||||
|
|
||||||
|
class KeyManager:
|
||||||
|
def __init__(self, file):
|
||||||
|
self.config = config = configparser.ConfigParser(dict_type=dict)
|
||||||
|
if file is not None:
|
||||||
|
config.read_file(file)
|
||||||
|
|
||||||
|
def get_key(self, name):
|
||||||
|
return self.config.get('keys', name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue