blob: 05e17b4da54b04872844fb49c5e7c141e74a65c4 [file] [log] [blame]
#!/bin/sh
set -e
{
domain=${SA_PUBLIC_DOMAIN_NAME:-miau.local}
live=/etc/nginx/certs/live
html=/var/www/html
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
rm -rf ${html}
cp -a /var/www/simpleid ${html}
for tmpl in /var/db/simpleid-templates/*.identity; do
ref=$(dirname ${tmpl})/$(basename ${tmpl} .identity)
name=$(basename ${ref})
sed "s/miau.local/${domain}/" ${ref} >${html}/${name}
done
for f in /etc/nginx/conf.d/sa.conf; do
sed "s/miau.local/${domain}/" ${f}.template >${f}
done
}
chown -R root:root /var/www/html/
chmod -R a-w /etc/nginx/certs/ /etc/nginx/conf.d/sa.conf /var/www/html/
exec /docker-entrypoint.sh "$@"