1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-10 04:12:15 +03:00

Add --force-localserver-for-auth CL arg to EDMarketConnector

This commit is contained in:
Athanasius 2021-01-23 13:38:08 +00:00
parent 409e851840
commit 5093fb58ee
2 changed files with 16 additions and 0 deletions

View File

@ -68,6 +68,11 @@ if __name__ == '__main__': # noqa: C901
action='store_true' 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() args = parser.parse_args()
if args.trace: if args.trace:
@ -76,6 +81,9 @@ if __name__ == '__main__': # noqa: C901
else: else:
edmclogger.set_channels_loglevel(logging.DEBUG) 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 def no_other_instance_running() -> bool: # noqa: CCR001
""" """
Ensure only one copy of the app is running for the configured journal directory. Ensure only one copy of the app is running for the configured journal directory.

View File

@ -117,6 +117,7 @@ class AbstractConfig(abc.ABC):
identifier: str identifier: str
__in_shutdown = False # Is the application currently shutting down ? __in_shutdown = False # Is the application currently shutting down ?
__auth_force_localserver = False # Should we use localhost for auth callback ?
def __init__(self) -> None: def __init__(self) -> None:
self.home_path = pathlib.Path.home() self.home_path = pathlib.Path.home()
@ -128,6 +129,13 @@ class AbstractConfig(abc.ABC):
def shutting_down(self) -> bool: def shutting_down(self) -> bool:
return self.__in_shutdown 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 @property
def app_dir(self) -> str: def app_dir(self) -> str:
"""Return a string version of app_dir.""" """Return a string version of app_dir."""