Skip to content

Commit

Permalink
ci: update start.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
fearlessfe committed Sep 22, 2024
1 parent 1dca302 commit b4cd321
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions start.sh
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;'

0 comments on commit b4cd321

Please sign in to comment.