Give user the option to disable SSL/TLS for the source and destination individually
This commit is contained in:
@@ -8,7 +8,7 @@ class API:
|
||||
__DEFAULT_API_PATH = "/api/v1"
|
||||
|
||||
def __init__(self, verify_ssl, ca_bundle):
|
||||
|
||||
|
||||
self.__verify_ssl = verify_ssl
|
||||
self.__ca_bundle = ca_bundle
|
||||
|
||||
@@ -21,7 +21,13 @@ class API:
|
||||
|
||||
return base
|
||||
|
||||
def get(self, hostname, port, token) -> gitea.Gitea:
|
||||
def get(
|
||||
self,
|
||||
hostname: str,
|
||||
port: int,
|
||||
token: str,
|
||||
verify_ssl: bool = None
|
||||
) -> gitea.Gitea:
|
||||
|
||||
url = API._make_api_base_url(
|
||||
hostname=hostname,
|
||||
@@ -29,8 +35,15 @@ class API:
|
||||
)
|
||||
|
||||
ssl_verify_arg = True
|
||||
if self.__verify_ssl is not None:
|
||||
if verify_ssl is not None:
|
||||
ssl_verify_arg = verify_ssl
|
||||
else:
|
||||
ssl_verify_arg = self.__verify_ssl
|
||||
|
||||
print(f"API::get -> hostname {hostname}")
|
||||
print(f"API::get -> verify_ssl was {verify_ssl}")
|
||||
print(f"API::get -> ssl_verify_arg became {ssl_verify_arg}")
|
||||
|
||||
if self.__ca_bundle is not None:
|
||||
ssl_verify_arg = self.__ca_bundle
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ class Migrator:
|
||||
self,
|
||||
source_host, source_port, source_token,
|
||||
destination_host, destination_port, destination_token,
|
||||
verify_ssl: bool = True, ca_bundle: str = None
|
||||
verify_ssl: bool = True, verify_source_ssl: bool = True, verify_destination_ssl: bool = True,
|
||||
ca_bundle: str = None
|
||||
):
|
||||
|
||||
# noinspection PyTypeChecker
|
||||
@@ -34,6 +35,9 @@ class Migrator:
|
||||
self.__destination_token = destination_token
|
||||
|
||||
self.__verify_ssl = verify_ssl
|
||||
self.__verify_source_ssl = verify_source_ssl
|
||||
self.__verify_destination_ssl = verify_destination_ssl
|
||||
|
||||
self.__ca_bundle = ca_bundle
|
||||
|
||||
api = API(
|
||||
@@ -45,12 +49,14 @@ class Migrator:
|
||||
hostname=self.__source_host,
|
||||
port=self.__source_port,
|
||||
token=self.__source_token,
|
||||
verify_ssl=self.__verify_source_ssl,
|
||||
|
||||
)
|
||||
self.__destination_api = api.get(
|
||||
hostname=self.__destination_host,
|
||||
port=self.__destination_port,
|
||||
token=self.__destination_token,
|
||||
verify_ssl=self.__verify_destination_ssl,
|
||||
)
|
||||
|
||||
def _init_logger(self):
|
||||
|
||||
Reference in New Issue
Block a user