[core] Ignore comments in configuration environment variables

Comments are treated as keys with no value by configparser, but env
variables with None as the value are not valid so this would crash.

Fixes #156
This commit is contained in:
derrod 2020-12-16 05:45:05 +01:00
parent 5e1896cf2c
commit 3e2a6011ff

View file

@ -375,9 +375,9 @@ class LegendaryCore:
# get environment overrides from config
env = os.environ.copy()
if 'default.env' in self.lgd.config:
env.update(dict(self.lgd.config['default.env']))
env.update({k: v for k, v in self.lgd.config[f'default.env'].items() if v and not k.startswith(';')})
if f'{app_name}.env' in self.lgd.config:
env.update(dict(self.lgd.config[f'{app_name}.env']))
env.update({k: v for k, v in self.lgd.config[f'{app_name}.env'].items() if v and not k.startswith(';')})
if wine_pfx:
env['WINEPREFIX'] = wine_pfx