From b0a5b80cd9cb3e8fb4c9d46feb5556ec63c51156 Mon Sep 17 00:00:00 2001 From: Cedric Hombourger Date: Thu, 3 Aug 2023 15:36:20 +0200 Subject: [PATCH] main: load MTDA_REMOTE from the environment even without config files Move os.getenv('MTDA_REMOTE') so that it gets called when mtda-cli is loaded without any configuration files. Fixes: #298 Signed-off-by: Cedric Hombourger --- mtda/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mtda/main.py b/mtda/main.py index 28533654..87e4c9a8 100644 --- a/mtda/main.py +++ b/mtda/main.py @@ -1183,7 +1183,7 @@ def load_config(self, remote=None, is_server=False, config_files=None): self.mtda.debug(2, "main.load_config(): " "config_files={}".format(config_files)) - self.remote = remote + self.remote = os.getenv('MTDA_REMOTE', remote) self.is_remote = remote is not None self.is_server = is_server parser = configparser.ConfigParser() @@ -1404,8 +1404,6 @@ def load_remote_config(self, parser): # Load remote setting from the configuration self.remote = parser.get( 'remote', 'host', fallback=self.remote) - # Allow override from the environment - self.remote = os.getenv('MTDA_REMOTE', self.remote) # Attempt to resolve remote using Zeroconf watcher = mtda.discovery.Watcher(CONSTS.MDNS.TYPE)