fetch: add environment variable interpolation
This commit is contained in:
parent
ee0cd0e70c
commit
cf82ed5ac4
1 changed files with 14 additions and 3 deletions
|
@ -371,7 +371,7 @@ def release(fn):
|
|||
sys.exit(3)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--config', help="Load configuration file", default="config.ini")
|
||||
parser.add_argument('--config', help="Load configuration file")
|
||||
parser.add_argument('-n', '--no-action', action="store_true", help='do not commit any database changes')
|
||||
parser.add_argument('-c', '--cached', action="store_true", help='use cached data (test)')
|
||||
parser.add_argument('-l', '--load', action='append', help='process specified files (test)')
|
||||
|
@ -382,8 +382,19 @@ parser.add_argument('--print-schema', action="store_true", help='print table sch
|
|||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(args.config)
|
||||
config = configparser.ConfigParser(defaults=os.environ, interpolation=configparser.ExtendedInterpolation())
|
||||
config.read_dict({
|
||||
'logging': {
|
||||
'level': 'INFO',
|
||||
},
|
||||
'general': {
|
||||
'cache_dir': 'cache',
|
||||
'lockfile': 'lockfile',
|
||||
},
|
||||
})
|
||||
|
||||
if args.config:
|
||||
config.read(args.config)
|
||||
|
||||
logging.basicConfig(level=config['logging']['level'], format=config['logging'].get('format', '%(asctime)s [%(levelname)s] %(name)s: %(message)s'))
|
||||
logging.getLogger('chardet').setLevel(logging.WARN)
|
||||
|
|
Loading…
Reference in a new issue