Load config from arguments first
This commit is contained in:
1 parent
50531c7b3e
commit
3703d2b9b9
1 file changed
+7
@@ -124,6 +124,13 @@ class RedditDownloader:
|
||||
|
||||
def _load_config(self):
|
||||
self.cfg_parser = configparser.ConfigParser()
|
||||
if self.args.config:
|
||||
if (cfg_path := Path(self.args.config)).exists():
|
||||
self.cfg_parser.read(cfg_path)
|
||||
self.config_location = cfg_path
|
||||
return
|
||||
else:
|
||||
logger.error(f'Could not find config file at {self.args.config}, attempting to find elsewhere')
|
||||
possible_paths = [Path('./config.cfg'),
|
||||
Path(self.config_directory, 'config.cfg'),
|
||||
Path('./default_config.cfg'),
|
||||
|
||||
Reference in new issue
Block a user