run 351 B

12345678910
  1. #!/bin/sh -e
  2. # Replace ENV vars in configuration files
  3. tmpfile=$(mktemp)
  4. cat /etc/nginx/nginx.conf | envsubst "$(env | cut -d= -f1 | sed -e 's/^/$/')" | tee "$tmpfile" > /dev/null
  5. mv "$tmpfile" /etc/nginx/nginx.conf
  6. # pipe stderr to stdout and run nginx omiting ENV vars to avoid security leaks
  7. exec 2>&1
  8. exec env - PATH=$PATH nginx -g 'daemon off;'