diff --git a/api-catalog-package/src/main/resources/bin/start.sh b/api-catalog-package/src/main/resources/bin/start.sh index 893f7c8d62..8745267bab 100755 --- a/api-catalog-package/src/main/resources/bin/start.sh +++ b/api-catalog-package/src/main/resources/bin/start.sh @@ -145,7 +145,7 @@ if [ "${ATTLS_ENABLED}" = "true" ]; then ZWE_configs_spring_profiles_active="${ZWE_configs_spring_profiles_active}attls" fi -if [ "${ZWE_configs_server_ssl_enabled:-true}" = "true" -o "$ATTLS_ENABLED" = "true" ]; then +if [ "${ZWE_configs_server_ssl_enabled:-true}" = "true" -o "$ATTLS_CLIENT_ENABLED" = "true" ]; then externalProtocol="https" else externalProtocol="http" @@ -153,7 +153,7 @@ fi # Verify discovery service URL in case AT-TLS is enabled, assumes outgoing rules are in place ZWE_DISCOVERY_SERVICES_LIST=${ZWE_DISCOVERY_SERVICES_LIST:-"https://${ZWE_haInstance_hostname:-localhost}:${ZWE_components_discovery_port:-7553}/eureka/"} -if [ "$ATTLS_ENABLED" = "true" -o "$ATTLS_CLIENT_ENABLED" = "true" ]; then # Keep current 2.18 behaviour, change in v3 +if [ "$ATTLS_ENABLED" = "true" -o "$ATTLS_CLIENT_ENABLED" = "true" ]; then # Keep current 2.18 behaviour, changed in v3 ZWE_DISCOVERY_SERVICES_LIST=$(echo "${ZWE_DISCOVERY_SERVICES_LIST=}" | sed -e 's|https://|http://|g') fi if [ "${ATTLS_CLIENT_ENABLED}" = "true" ]; then diff --git a/discovery-package/src/main/resources/bin/configure.sh b/discovery-package/src/main/resources/bin/configure.sh new file mode 100755 index 0000000000..6584b6a7b3 --- /dev/null +++ b/discovery-package/src/main/resources/bin/configure.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +################################################################################ +# This program and the accompanying materials are made available under the terms of the +# Eclipse Public License v2.0 which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-v20.html +# +# SPDX-License-Identifier: EPL-2.0 +# +# Copyright IBM Corporation 2021 +################################################################################ + +if [ -z "$ZWE_zowe_workspaceDirectory" ]; then + echo "Workspace directory is not defined" + exit 1 +fi + +echo "$(env)" > $ZWE_zowe_workspaceDirectory/api-mediation/api-defs/env + +INSTANCE_ID=$ZWE_haInstance_id + +if [ -z "$INSTANCE_ID" ]; then + SOURCE_FILE=$ZWE_zowe_workspaceDirectory/api-mediation/api-defs/discovery.zosmf_static_definition_yaml_template.yml +else + SOURCE_FILE=$ZWE_zowe_workspaceDirectory/api-mediation/api-defs/discovery.zosmf_static_definition_yaml_template.$INSTANCE_ID.yml +fi + +DEST_FILE="$ZWE_zowe_workspaceDirectory/api-mediation/api-defs/zosmf.temp" + +ZOSMF_SCHEME=https + +if [ "$ZWE_zowe_network_client_tls_attls" = "true" ]; then + ZOSMF_SCHEME=http +fi + +if [ -e "$SOURCE_FILE" ]; then + chtag -tc ISO8859-1 $SOURCE_FILE + sed -e "s|%ZOSMF_SCHEME%|${ZOSMF_SCHEME}|g" $SOURCE_FILE > $DEST_FILE + iconv -f IBM-1047 -t ISO8859-1 $DEST_FILE > $SOURCE_FILE + chtag -tc ISO8859-1 $SOURCE_FILE + rm -f $DEST_FILE +else + echo "File $SOURCE_FILE not found" +fi diff --git a/discovery-package/src/main/resources/manifest.yaml b/discovery-package/src/main/resources/manifest.yaml index 9156595c70..8a85d86c50 100644 --- a/discovery-package/src/main/resources/manifest.yaml +++ b/discovery-package/src/main/resources/manifest.yaml @@ -21,6 +21,7 @@ build: commands: start: bin/start.sh validate: bin/validate.sh + configure: bin/configure.sh # if we need to automatically tag file encoding on z/OS during installation autoEncoding: # tag all files diff --git a/discovery-package/src/main/resources/zosmf-static-definition.yaml.template b/discovery-package/src/main/resources/zosmf-static-definition.yaml.template index a5b8865614..6835bdc8eb 100644 --- a/discovery-package/src/main/resources/zosmf-static-definition.yaml.template +++ b/discovery-package/src/main/resources/zosmf-static-definition.yaml.template @@ -8,7 +8,7 @@ services: title: z/OSMF description: IBM z/OS Management Facility REST API service instanceBaseUrls: - - ${ZWE_zOSMF_scheme:-https}://${ZOSMF_HOST}:${ZOSMF_PORT}/zosmf/ + - %ZOSMF_SCHEME%://${ZOSMF_HOST}:${ZOSMF_PORT}/zosmf/ homePageRelativeUrl: # Home page is at the same URL routedServices: - gatewayUrl: api/v1 @@ -29,7 +29,7 @@ services: description: 'IBM z/OS Management Facility REST API service. Once configured you can access z/OSMF via the API gateway: https://${ZOWE_EXPLORER_HOST}:${GATEWAY_PORT}/ibmzosmf/api/v1/info' catalogUiTileId: zosmf instanceBaseUrls: - - ${ZWE_zOSMF_scheme:-https}://${ZOSMF_HOST}:${ZOSMF_PORT}/ + - %ZOSMF_SCHEME%://${ZOSMF_HOST}:${ZOSMF_PORT}/ homePageRelativeUrl: # Home page is at the same URL routedServices: - gatewayUrl: api/v1 @@ -40,7 +40,7 @@ services: - apiId: ibm.zosmf gatewayUrl: api/v1 documentationUrl: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.izua700/IZUHPINFO_RESTServices.htm - swaggerUrl: ${ZWE_zOSMF_scheme:-https}://${ZOSMF_HOST}:${ZOSMF_PORT}/zosmf/api/docs + swaggerUrl: %ZOSMF_SCHEME%://${ZOSMF_HOST}:${ZOSMF_PORT}/zosmf/api/docs customMetadata: apiml: enableUrlEncodedCharacters: true diff --git a/gateway-package/src/main/resources/bin/start.sh b/gateway-package/src/main/resources/bin/start.sh index cb7df0326f..aa9d76a4cd 100755 --- a/gateway-package/src/main/resources/bin/start.sh +++ b/gateway-package/src/main/resources/bin/start.sh @@ -190,7 +190,6 @@ if [ "${ATTLS_CLIENT_ENABLED}" = "true" -o "${ATTLS_ENABLED}" = "true" ]; then fi if [ "${ATTLS_CLIENT_ENABLED}" = "true" ]; then - export ZWE_zOSMF_scheme="http" internalProtocol=http fi