introduce force_filename to set filename exclusively

This commit is contained in:
Marcus Stoegbauer 2024-03-30 00:24:55 +01:00
parent 57b3600d47
commit 4790429f24

View File

@ -7,12 +7,13 @@ class Conf(object):
_cfgfiles = [] _cfgfiles = []
debug = None debug = None
def __init__(self, filename=None, debug=None): def __init__(self, filename=None, debug=None, force_filename=False):
if debug: if debug:
self.set_debug(debug) self.set_debug(debug)
filenames = [] filenames = []
if filename: if filename:
filenames.append(filename) filenames.append(filename)
if not force_filename:
filenames.append(f'{os.environ.get("HOME")}/etc/userconfig2.conf') filenames.append(f'{os.environ.get("HOME")}/etc/userconfig2.conf')
ret = self.set_filenames(filenames) ret = self.set_filenames(filenames)
if not ret: if not ret: