From 88648586eef3662282b638a7bd4698620e3eb75f Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Tue, 20 Nov 2018 15:57:46 +0800 Subject: support not authenticate testapi Change-Id: I29db99414d53155a6eec96f93169e07523645b12 Signed-off-by: SerenaFeng --- testapi/docker/prepare-env.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/testapi/docker/prepare-env.sh b/testapi/docker/prepare-env.sh index 9086e77..a1b01bd 100755 --- a/testapi/docker/prepare-env.sh +++ b/testapi/docker/prepare-env.sh @@ -2,18 +2,20 @@ FILE=/etc/opnfv_testapi/config.ini -if [ "$mongodb_url" != "" ]; then - sudo crudini --set --existing $FILE mongo url $mongodb_url -fi +[[ "${mongodb_url}" == "" ]] && mongodb_url=mongodb://mongo:27017/ +[[ "${base_url}" == "" ]] && base_url=http://localhost:8000 +[[ ! "${auth}" =~ [f|F]alse ]] && auth=true -if [ "$base_url" != "" ]; then - sudo crudini --set --existing $FILE api url $base_url/api/v1 - sudo crudini --set --existing $FILE ui url $base_url - sudo cat > /usr/local/share/opnfv_testapi/testapi-ui/config.json << EOF +auth_server=`echo ${auth:0:1} | tr '[:lower:]' '[:upper:]'``echo ${auth:1} | tr '[:upper:]' '[:lower:]'` +auth_web=`echo ${auth} | tr '[:upper:]' '[:lower:]'` +sudo crudini --set --existing ${FILE} mongo url ${mongodb_url} +sudo crudini --set --existing ${FILE} api url ${base_url}/api/v1 +sudo crudini --set --existing ${FILE} ui url ${base_url} +sudo crudini --set --existing ${FILE} api authenticate ${auth_server} + +sudo cat > /usr/local/share/opnfv_testapi/testapi-ui/config.json << EOF { - "testapiApiUrl": "$base_url/api/v1", - "authenticate": true + "testapiApiUrl": "${base_url}/api/v1", + "authenticate": ${auth_web} } EOF - -fi -- cgit 1.2.3-korg