prepare.sh 1.1 KB

123456789101112131415161718192021
  1. #!/bin/sh
  2. echo "[PREPARE] docker/server/prepare.sh'"
  3. # Load all environment variables from 'attributes.sh' using the command 'source /path/attributes.sh'
  4. source "docker/attributes.sh"
  5. export OPEN_SEARCH_HOST_FOR_NGINX="$(echo "${OPEN_SEARCH_HOST}" | cut -d "/" -f 3 | cut -d ":" -f 1)"
  6. # The lines below will replace the environment variables in the templates with the corresponding variables listed above. To accomplish this, the GNU 'envsubst' package will be used
  7. # Although not recommended (if you do not know what you are doing), you still have the option to add new substitution file templates using any required environment variables
  8. if [[ ! -s ${CONFIG_NGINX_TEMPLATE} ]]; then
  9. cp "docker/server/fastcgi.conf" /etc/nginx/fastcgi.conf
  10. cp "docker/server/nginx.conf" /etc/nginx/http.d/librex.conf
  11. # To address issues with 'nginx.conf', the following lines will ensure that these configurations remain executable
  12. chmod u+x "/etc/nginx/fastcgi.conf"
  13. chmod u+x "/etc/nginx/http.d/librex.conf"
  14. cat 'docker/server/nginx.conf' | envsubst '${OPEN_SEARCH_HOST_FOR_NGINX}' > ${CONFIG_NGINX_TEMPLATE};
  15. fi