fix(config): make config file keys case sensitive

Since the configparser library by default parses keys case insensitive
(all lowercase), certain mappings, especially in the pulseaudio modules,
could fail ("internal" pulseaudio device names are matched against
entries in the configuration).

fixes #992
This commit is contained in:
tobi-wan-kenobi 2023-09-15 15:06:57 +02:00
parent 8583b5123e
commit b42323013d
2 changed files with 14 additions and 3 deletions

View file

@ -240,11 +240,16 @@ class Config(util.store.Store):
:param filename: path to the file to load
"""
def load_config(self, filename):
if os.path.exists(filename):
def load_config(self, filename, content=None):
if os.path.exists(filename) or content != None:
log.info("loading {}".format(filename))
tmp = RawConfigParser()
tmp.read(u"{}".format(filename))
tmp.optionxform = str
if content:
tmp.read_string(content)
else:
tmp.read(u"{}".format(filename))
if tmp.has_section("module-parameters"):
for key, value in tmp.items("module-parameters"):