Skip to content

Commit

Permalink
main: load MTDA_REMOTE from the environment even without config files
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
chombourger committed Aug 3, 2023
1 parent f3866e8 commit e3b31cb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions mtda/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e3b31cb

Please sign in to comment.