mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 17:33:23 +00:00
[e2e] Enable CORS for CouchDB in CI (#5702)
This commit is contained in:
parent
0f12aa1eae
commit
e3770dc701
@ -83,6 +83,18 @@ create_admin_user () {
|
||||
curl -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/admins/$COUCH_ADMIN_USER -d \'"$COUCH_ADMIN_PASSWORD"\'
|
||||
}
|
||||
|
||||
is_cors_enabled() {
|
||||
resource_exists $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/httpd/enable_cors
|
||||
}
|
||||
|
||||
enable_cors () {
|
||||
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/httpd/enable_cors -d '"true"'
|
||||
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/origins -d '"http://localhost:8080"'
|
||||
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/credentials -d '"true"'
|
||||
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
|
||||
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/headers -d '"accept, authorization, content-type, origin, referer, x-csrf-token"'
|
||||
}
|
||||
|
||||
if [ "$(admin_user_exists)" == "FALSE" ]; then
|
||||
echo "Admin user does not exist, creating..."
|
||||
create_admin_user
|
||||
@ -123,3 +135,10 @@ if [ "{\"ok\":true}" == "${response}" ]; then
|
||||
else
|
||||
echo "Database permissions not updated"
|
||||
fi
|
||||
|
||||
if [ "FALSE" == $(is_cors_enabled) ]; then
|
||||
echo "Enabling CORS"
|
||||
enable_cors
|
||||
else
|
||||
echo "CORS enabled, nothing to do"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user