entrypoint.sh 1001 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. if [ ! -n "${BACKEND_URL}" ]; then
  3. BACKEND_URL="http://127.0.0.1:12184"
  4. fi
  5. if [ ! -n "${RBAC_SERVER_URL}" ]; then
  6. RBAC_SERVER_URL="http://127.0.0.1:12180"
  7. fi
  8. if [ ! -n "${RBAC_APP_ID}" ]; then
  9. RBAC_APP_ID="unknow"
  10. fi
  11. if [ ! -n "${AGENT_PORT}" ]; then
  12. AGENT_PORT="12182"
  13. fi
  14. if [ ! -n "${EXTENSION_CONFIG}" ]; then
  15. EXTENSION_CONFIG="#EXTENSION_CONFIG"
  16. fi
  17. if [ ! -n "${ACCESS_CHECK_LUA}" ]; then
  18. ACCESS_CHECK_LUA="access_check.lua"
  19. fi
  20. sed -e "s|http://127.0.0.1:12184|${BACKEND_URL}|" \
  21. -e "s|http://127.0.0.1:12180|${RBAC_SERVER_URL}|" \
  22. -e "s/unknow/${RBAC_APP_ID}/" \
  23. -e "s/12182/${AGENT_PORT}/" \
  24. -e "s|#EXTENSION_CONFIG|${EXTENSION_CONFIG}|" \
  25. -e "s|access_check.lua|${ACCESS_CHECK_LUA}|" \
  26. conf/server-demo.conf \
  27. > /etc/nginx/conf.d/app-${RBAC_APP_ID}.conf
  28. echo "------------- nginx config -------------"
  29. cat /etc/nginx/conf.d/app-${RBAC_APP_ID}.conf
  30. echo "-----------------------------------------"
  31. /usr/local/openresty/bin/openresty -g "daemon off;"