blob: 34e10f114b5342f03ac2e90f8ee075bbf753ac2c [file] [log] [blame]
#!/bin/sh
set -e
{
domain=${SA_PUBLIC_DOMAIN_NAME:-miau.local}
live=/etc/nginx/certs/live
if [ ! -f ${live}/${domain}/privkey.pem ]; then
mkdir -p ${live}/${domain}
cp /etc/ssl/private/sa-selfsigned.key ${live}/${domain}/privkey.pem
cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/fullchain.pem
cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/chain.pem
cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/cert.pem
fi
for f in /etc/nginx/conf.d/sa.conf; do
sed "s/miau.local/${domain}/" ${f}.template >${f}
done
}
chmod -R a-w /etc/nginx/certs/ /etc/nginx/conf.d/sa.conf
exec /docker-entrypoint.sh "$@"