def read_config(scan_config):
config_path = os.path.join(
os.path.dirname(os.path.realpath(sys.argv[0])), "config.json")
if os.path.isfile(config_path):
config['CONFIG_PATH'] = config_path
try:
with open(config_path, "r") as f:
c = json.loads(f.read())
except:
c = {}
config['LOCALE'] = c.get('LOCALE', 'en')
config['GOOGLEMAPS_KEY'] = c.get('GOOGLEMAPS_KEY', None)
config['CONFIG_PASSWORD'] = c.get('CONFIG_PASSWORD', None)
config['ACCOUNTS'] = c.get('ACCOUNTS', [])
scan_config.update_scan_locations(c.get('SCAN_LOCATIONS', {}))
if config.get('CONFIG_PASSWORD', None):
config['AUTH_KEY'] = ''.join(random.choice(string.lowercase) for _ in range(32))
评论列表
文章目录