Use https when VESPA_TLS_ENABLED is set
@@ -11,6 +11,13 @@ set -e
CURL_PARAMETERS=$1
CONFIGSERVER_URI_WITHOUT_SCHEME=$2
+if [ -n "${VESPA_TLS_ENABLED}" ]
+then
+ CONFIGSERVER_URI="https://${CONFIGSERVER_URI_WITHOUT_SCHEME}"
+else
+ CONFIGSERVER_URI="http://${CONFIGSERVER_URI_WITHOUT_SCHEME}"
+fi
+
if [ -n "${VESPA_TLS_CA_CERT}" ]
then
CURL_PARAMETERS="--cacert \"${VESPA_TLS_CA_CERT}\" ${CURL_PARAMETERS}"
@@ -19,9 +26,6 @@ fi
if [[ -n "${VESPA_TLS_CERT}" && -n "${VESPA_TLS_PRIVATE_KEY}" ]]
then
CURL_PARAMETERS="--cert \"${VESPA_TLS_CERT}\" --key \"${VESPA_TLS_PRIVATE_KEY}\" ${CURL_PARAMETERS}"
- CONFIGSERVER_URI="https://${CONFIGSERVER_URI_WITHOUT_SCHEME}"
-else
- CONFIGSERVER_URI="http://${CONFIGSERVER_URI_WITHOUT_SCHEME}"
fi
curl ${CURL_PARAMETERS} "${CONFIGSERVER_URI}"
