From 1b3ef319635480374633d4c6c9a0704d4df03072 Mon Sep 17 00:00:00 2001 From: derrod Date: Sun, 26 Apr 2020 14:58:09 +0200 Subject: [PATCH] [cli/core] Fix config offline and environment overrides --- legendary/cli.py | 4 +++- legendary/core.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/legendary/cli.py b/legendary/cli.py index 319c88e..0e9e2f9 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -128,7 +128,9 @@ class LegendaryCLI: logger.error(f'{app_name} is DLC; please launch the base game instead!') exit(1) - if not args.offline and not self.core.is_offline_game(app_name): + # override with config value + args.offline = self.core.is_offline_game(app_name) + if not args.offline: logger.info('Logging in...') if not self.core.login(): logger.error('Login failed, cannot continue!') diff --git a/legendary/core.py b/legendary/core.py index c629791..0dfd122 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -253,11 +253,11 @@ class LegendaryCore: params.extend(shlex.split(config_args.strip())) # get environment overrides from config - env = None + env = os.environ.copy() if f'{app_name}.env' in self.lgd.config: - env = dict(self.lgd.config[f'{app_name}.env']) + env.update(dict(self.lgd.config[f'{app_name}.env'])) elif 'default.env' in self.lgd.config: - env = dict(self.lgd.config['default.env']) + env.update(dict(self.lgd.config['default.env'])) return params, working_dir, env