summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2018-11-20 15:57:46 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2018-11-20 15:57:46 +0800
commit88648586eef3662282b638a7bd4698620e3eb75f (patch)
tree5126200fcb12db1f2a20bdae9eaccd0adc461c33
parent207b19129471b00d62bf8512e68fbfa49f89adad (diff)
support not authenticate testapiHEADmaster
Change-Id: I29db99414d53155a6eec96f93169e07523645b12 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
-rwxr-xr-xtestapi/docker/prepare-env.sh24
1 files 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