From 5093fb58ee374032943f0fd8227e1d9ced350433 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Sat, 23 Jan 2021 13:38:08 +0000 Subject: [PATCH] Add `--force-localserver-for-auth` CL arg to EDMarketConnector --- EDMarketConnector.py | 8 ++++++++ config.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 29fe30d5..2088489b 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -68,6 +68,11 @@ if __name__ == '__main__': # noqa: C901 action='store_true' ) + parser.add_argument('--force-localserver-for-auth', + help='Force EDMC to use a localhost webserver for Frontier Auth callback', + action='store_true' + ) + args = parser.parse_args() if args.trace: @@ -76,6 +81,9 @@ if __name__ == '__main__': # noqa: C901 else: edmclogger.set_channels_loglevel(logging.DEBUG) + if args.force_localserver_for_auth: + config.set_auth_force_localserver() + def no_other_instance_running() -> bool: # noqa: CCR001 """ Ensure only one copy of the app is running for the configured journal directory. diff --git a/config.py b/config.py index 8e3ef9be..06ccfc35 100644 --- a/config.py +++ b/config.py @@ -117,6 +117,7 @@ class AbstractConfig(abc.ABC): identifier: str __in_shutdown = False # Is the application currently shutting down ? + __auth_force_localserver = False # Should we use localhost for auth callback ? def __init__(self) -> None: self.home_path = pathlib.Path.home() @@ -128,6 +129,13 @@ class AbstractConfig(abc.ABC): def shutting_down(self) -> bool: return self.__in_shutdown + def set_auth_force_localserver(self): + self.__auth_force_localserver = True + + @property + def auth_force_localserver(self) -> bool: + return self.__auth_force_localserver + @property def app_dir(self) -> str: """Return a string version of app_dir."""