-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dca302
commit b4cd321
Showing
1 changed file
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# wait deps start | ||
sleep 5 | ||
|
||
curl_response=$(curl -s -H "Authorization: Bearer $ADMIN_KEY" http://meiliSearch:7700/keys) | ||
API_KEY=$(echo "$curl_response" | jq -r '.results[] | select(.actions[] | contains("*")) | .key') | ||
|
||
echo "Successfully get the KEY $API_KEY." | ||
NGINX_CONF="/etc/nginx/nginx.conf" | ||
|
||
sed -i "s/KEY/$API_KEY/g" $NGINX_CONF | ||
sed -i "s/TOKEN/$API_KEY/g" "$NGINX_CONF" || { | ||
echo "Warning: Failed to replace KEY in $NGINX_CONF. Continuing with the unmodified configuration." | ||
} | ||
|
||
nginx -t -c "$NGINX_CONF" | ||
if [ $? -ne 0 ]; then | ||
echo "Error: NGINX configuration test failed. Please check the configuration." | ||
exit 1 | ||
fi | ||
|
||
nginx | ||
nginx -g 'daemon off;' |