master #4

Manually merged
djib merged 3 commits from sebastian404/PDMameUpdate:master into master 2020-03-31 22:47:16 +02:00
3 changed files with 30 additions and 7 deletions
Showing only changes of commit e1c7c9dde5 - Show all commits

View File

@ -48,6 +48,7 @@ import os
import re
import requests
import time
import pathlib
from clutch.core import Client
from tabulate import tabulate
from collections import defaultdict
@ -58,8 +59,16 @@ from urllib.parse import quote
def open_config_file():
"""Reads configuration from config.json file"""
logging.info('Opening config file: config.json')
with open('config.json') as config_file:
for loc in os.environ.get("PDMAMEUPDATE_CONF"), "/etc", os.path.expanduser("~"), os.curdir:
if loc is not None:
config_path = loc + '/config.json'
if pathlib.Path(config_path).is_file():
config_file_loc = config_path
break
logging.info('Opening config file: '+config_file_loc)
config_file = None;
with open(config_file_loc, 'r') as config_file:
config = json.load(config_file)
return config