diff --git a/bin/configure.sh b/bin/configure.sh new file mode 100644 index 0000000..808c638 --- /dev/null +++ b/bin/configure.sh @@ -0,0 +1,45 @@ +#!/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 2020 +################################################################################ + +# Variables required on shell: +# STATIC_DEF_CONFIG_DIR=${INSTANCE_DIR}/workspace/api-mediation/api-defs +# ZOWE_EXPLORER_HOST +# MY_API_NAME +# MY_API_PORT + +echo 'sample-node-api configure begin' + +echo "LAUNCH_COMPONENT: ${LAUNCH_COMPONENT} " +COMPONENT_DIR=$(dirname "${LAUNCH_COMPONENT}") +echo "COMPONENT_DIR: ${COMPONENT_DIR}" + +# load config from env +echo 'load sample-node-api config' +. ${COMPONENT_DIR}/bin/env.sh + +echo 'Add static definition for sample-node-api' +#configure based on env.sh +sed -e "s/mymainframe.ibm.com/${ZOWE_EXPLORER_HOST}/g" \ + -e "s/18000/${MY_API_PORT}/g" \ + ${COMPONENT_DIR}/${MY_API_NAME}.yml \ + > ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml + +echo 'change sample-node-api.ebcidic.yml encoding from ibm-1047 to ibm-850' +# basically this yml file is only thing we need to do register our service with apiml +# check if z/OS +# iconv -f IBM-1047 -t IBM-850 ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml > $STATIC_DEF_CONFIG_DIR/${MY_API_NAME}.yml + +cp ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml $STATIC_DEF_CONFIG_DIR/${MY_API_NAME}.yml +rm ${STATIC_DEF_CONFIG_DIR}/${MY_API_NAME}.ebcidic.yml +chmod 770 $STATIC_DEF_CONFIG_DIR/${MY_API_NAME}.yml + +echo 'sample-node-api configure done' \ No newline at end of file diff --git a/package.json b/package.json index 6a4d1fd..8788935 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "nodemon src/index.js", "dev:https": "nodemon src/index.js --key sslcert/server.key --cert sslcert/server.cert", "start": "node src/index.js", - "build": "npm run clean && cp -r src dist/src && cp -r bin dist/bin && cp *.yaml.template dist && cp *.yaml dist && cp *.json dist && cp README.md dist && cp LICENSE dist", + "build": "npm run clean && cp -r src dist/src && cp -r bin dist/bin && cp *.yaml.template dist && cp *.yml dist && cp *.yaml dist && cp *.json dist && cp README.md dist && cp LICENSE dist", "clean": "rimraf dist && mkdirp dist" }, "author": "", diff --git a/sample-node-api.yml b/sample-node-api.yml new file mode 100644 index 0000000..9d0af3c --- /dev/null +++ b/sample-node-api.yml @@ -0,0 +1,23 @@ +# +services: + - serviceId: sample-node-api + title: Sample-Node-API + description: Sample Node API + catalogUiTileId: sample-node-api + instanceBaseUrls: + - http://mymainframe.ibm.com:18000/ + homePageRelativeUrl: # Home page is at the same URL + routedServices: + - gatewayUrl: api/v1 # [api/ui/ws]/v{majorVersion} + serviceRelativeUrl: + apiInfo: + - apiId: com.ibm.sample-node-api + gatewayUrl: api/v1 + version: 1.0.0 + swaggerUrl: http://mymainframe.ibm.com:18000/api-docs + documentationUrl: http://mymainframe.ibm.com:18000/api-docs-ui + +catalogUiTiles: + sample-node-api: + title: Sample-Node-API + description: Sample Node API \ No newline at end of file