summaryrefslogtreecommitdiffstats
path: root/docker/storperf-swaggerui/run.sh
diff options
context:
space:
mode:
authorTaseer Ahmed <taseer94@gmail.com>2017-08-04 10:45:35 +0500
committerMark Beierl <mark.beierl@dell.com>2017-08-17 15:09:47 +0000
commitde09799887339c5af02d96e20bb417fa65dbc8d1 (patch)
tree7a6bf31b96ec3f65f2d28ef440a8b7c1a8ce2366 /docker/storperf-swaggerui/run.sh
parent1d3a2a843e03b8e36d6ac2069fdb1e143b08c91c (diff)
Support for Docker images on ARM processors.
- Usage: docker build --build-arg ARCH=<arch_type> . Change-Id: I9018c627cef05e69492dbdefbe750d72cf98064d Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
Diffstat (limited to 'docker/storperf-swaggerui/run.sh')
-rw-r--r--docker/storperf-swaggerui/run.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/docker/storperf-swaggerui/run.sh b/docker/storperf-swaggerui/run.sh
new file mode 100644
index 0000000..ab98585
--- /dev/null
+++ b/docker/storperf-swaggerui/run.sh
@@ -0,0 +1,53 @@
+#! /bin/sh
+##############################################################################
+# Copyright (c) 2017 Dell EMC and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+#
+# From https://github.com/schickling/dockerfiles/blob/master/swagger-ui/run.sh
+#
+set -e
+
+replace_in_index () {
+ if [ "$1" != "**None**" ]; then
+ sed -i "s|/\*||g" index.html
+ sed -i "s|\*/||g" index.html
+ sed -i "s|$1|$2|g" index.html
+ fi
+}
+
+replace_or_delete_in_index () {
+ if [ -z "$2" ]; then
+ sed -i "/$1/d" index.html
+ else
+ replace_in_index $1 $2
+ fi
+}
+
+replace_in_index myApiKeyXXXX123456789 $API_KEY
+replace_or_delete_in_index your-client-id $OAUTH_CLIENT_ID
+replace_or_delete_in_index your-client-secret-if-required $OAUTH_CLIENT_SECRET
+replace_or_delete_in_index your-realms $OAUTH_REALM
+replace_or_delete_in_index your-app-name $OAUTH_APP_NAME
+if [ "$OAUTH_ADDITIONAL_PARAMS" != "**None**" ]; then
+ replace_in_index "additionalQueryStringParams: {}" "additionalQueryStringParams: {$OAUTH_ADDITIONAL_PARAMS}"
+fi
+
+if [[ -f $SWAGGER_JSON ]]; then
+ sed -i "s|http://petstore.swagger.io/v2/swagger.json|swagger.json|g" index.html
+ sed -i "s|http://example.com/api|swagger.json|g" index.html
+else
+ sed -i "s|http://petstore.swagger.io/v2/swagger.json|$API_URL|g" index.html
+ sed -i "s|http://example.com/api|$API_URL|g" index.html
+fi
+
+if [[ -n "$VALIDATOR_URL" ]]; then
+ sed -i "s|.*validatorUrl:.*$||g" index.html
+ sed -i "s|\(url: url,.*\)|\1\n validatorUrl: \"${VALIDATOR_URL}\",|g" index.html
+fi
+
+exec http-server -p $PORT $* \ No newline at end of file