From 7ddd6b9fcca9bba8e82fd787ea5524c638d4fbd1 Mon Sep 17 00:00:00 2001 From: "jj-author@users.noreply.github.com" Date: Mon, 21 Oct 2024 10:22:27 +0200 Subject: [PATCH] corrected types of port and flag parameters --- ontologytimemachine/custom_proxy.py | 2 +- ontologytimemachine/utils/config.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ontologytimemachine/custom_proxy.py b/ontologytimemachine/custom_proxy.py index 2ecb9d6..3e93056 100644 --- a/ontologytimemachine/custom_proxy.py +++ b/ontologytimemachine/custom_proxy.py @@ -185,7 +185,7 @@ def queue_response(self, response): sys.argv += [ "--hostname", config.host, - "--port", config.port, + "--port", str(config.port), # "--log-level", config.logLevel.name, '--insecure-tls-interception', # without it the proxy would not let through a response using an invalid upstream certificate in interception mode # since there currently is a bug in proxypy when a connect request uses an IP address instead of a domain name diff --git a/ontologytimemachine/utils/config.py b/ontologytimemachine/utils/config.py index 6786894..ffb9ea3 100644 --- a/ontologytimemachine/utils/config.py +++ b/ontologytimemachine/utils/config.py @@ -78,7 +78,7 @@ class Config: disableRemovingRedirects: bool = False timestamp: str = "" host: str = "0.0.0.0" - port: str = "8896" + port: int = 8898 # manifest: Dict[str, Any] = None @@ -123,7 +123,7 @@ def parse_arguments(config_str: str = "") -> Config: parser.add_argument( "--patchAcceptUpstream", - type=bool, + action="store_true", default=default_cfg.ontoFormatConf.patchAcceptUpstream, help="Defines if the Accept Header is patched upstream in original mode. (default: %(default)s)", ) @@ -140,7 +140,7 @@ def parse_arguments(config_str: str = "") -> Config: # Enable/disable mode to only proxy requests to ontologies parser.add_argument( "--restrictedAccess", - type=bool, + action="store_true", default=default_cfg.restrictedAccess, help="Enable/disable mode to only proxy requests to ontologies stored in Archivo. (default: %(default)s)", ) @@ -157,7 +157,7 @@ def parse_arguments(config_str: str = "") -> Config: # Enable/disable inspecting or removing redirects parser.add_argument( "--disableRemovingRedirects", - type=bool, + action="store_true", default=default_cfg.disableRemovingRedirects, help="Enable/disable inspecting or removing redirects. (default: %(default)s)", ) @@ -190,9 +190,10 @@ def parse_arguments(config_str: str = "") -> Config: # Port parser.add_argument( "--port", - type=str, + type=int, default=default_cfg.port, - help="Port number to bind the proxy to. (default: %(default)s)", + help="port" + # help="Port number to bind the proxy to. (default: %(default)s)", ) if config_str: