From 25a5b7ae680a120672faae4c2a1381b9e89f2a14 Mon Sep 17 00:00:00 2001 From: dengyh Date: Mon, 22 Jun 2020 11:14:17 +0800 Subject: [PATCH] upgrade code to add HTTP/HTTPS protocol registration switch to MSB Change-Id: I6867304ec4f934a5dee274811000f1e4be365f73 Issue-ID: MODELING-372 Signed-off-by: dengyh --- catalog/pub/config/config.py | 9 +++++++++ docker/instance_config.sh | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/catalog/pub/config/config.py b/catalog/pub/config/config.py index 2b8f1a0..c1d4695 100644 --- a/catalog/pub/config/config.py +++ b/catalog/pub/config/config.py @@ -32,10 +32,16 @@ FORWARDED_FOR_FIELDS = ["HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED_HOST", # [register] REG_TO_MSB_WHEN_START = True +SSL_ENABLED = "true" REG_TO_MSB_REG_URL = "/api/microservices/v1/services" +if SSL_ENABLED == "true": + enable_ssl = "true" +else: + enable_ssl = "false" REG_TO_MSB_REG_PARAM = [{ "serviceName": "catalog", "version": "v1", + "enable_ssl": enable_ssl, "url": "/api/catalog/v1", "protocol": "REST", "visualRange": "1", @@ -47,6 +53,7 @@ REG_TO_MSB_REG_PARAM = [{ }, { "serviceName": "nsd", "version": "v1", + "enable_ssl": enable_ssl, "url": "/api/nsd/v1", "protocol": "REST", "visualRange": "1", @@ -58,6 +65,7 @@ REG_TO_MSB_REG_PARAM = [{ }, { "serviceName": "vnfpkgm", "version": "v1", + "enable_ssl": enable_ssl, "url": "/api/vnfpkgm/v1", "protocol": "REST", "visualRange": "1", @@ -69,6 +77,7 @@ REG_TO_MSB_REG_PARAM = [{ }, { "serviceName": "parser", "version": "v1", + "enable_ssl": enable_ssl, "url": "/api/parser/v1", "protocol": "REST", "visualRange": "1", diff --git a/docker/instance_config.sh b/docker/instance_config.sh index e312cf3..7fcaa7a 100755 --- a/docker/instance_config.sh +++ b/docker/instance_config.sh @@ -21,6 +21,11 @@ if [ $SERVICE_IP ]; then sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" modeling/etsicatalog/catalog/pub/config/config.py fi + +if [ $SSL_ENABLED ]; then + sed -i "s|SSL_ENABLED.*|SSL_ENABLED = '$SSL_ENABLED'|" modeling/etsicatalog/catalog/pub/config/config.py +fi + MYSQL_IP=`echo $MYSQL_ADDR | cut -d: -f 1` MYSQL_PORT=`echo $MYSQL_ADDR | cut -d: -f 2` echo "MYSQL_ADDR=$MYSQL_ADDR" -- 2.16.6