blob: 515301c7f497a09e4a7edeeeb1b90fc9663fafa9 [file] [log] [blame]
Nico Huberd6528722023-07-01 14:38:39 +00001#!/bin/sh
2
3set -e
4
5{
6 domain=${SA_PUBLIC_DOMAIN_NAME:-miau.local}
Nico Huber15edd772023-07-01 18:16:50 +00007 live=/etc/nginx/certs/live
Nico Huberd6528722023-07-01 14:38:39 +00008 html=/var/www/html
9
Nico Huber15edd772023-07-01 18:16:50 +000010 if [ ! -f ${live}/${domain}/privkey.pem ]; then
11 mkdir -p ${live}/${domain}
12 cp /etc/ssl/private/sa-selfsigned.key ${live}/${domain}/privkey.pem
13 cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/fullchain.pem
14 cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/chain.pem
15 cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/cert.pem
16 fi
17
Nico Huberd6528722023-07-01 14:38:39 +000018 rm -rf ${html}
19 cp -a /var/www/simpleid ${html}
20
21 for tmpl in /var/db/simpleid-templates/*.identity; do
22 ref=$(dirname ${tmpl})/$(basename ${tmpl} .identity)
23 name=$(basename ${ref})
24 sed "s/miau.local/${domain}/" ${ref} >${html}/${name}
25 done
26
27 for f in /etc/nginx/conf.d/sa.conf; do
28 sed "s/miau.local/${domain}/" ${f}.template >${f}
29 done
30}
31
32chown -R nginx:nginx /var/www/html/
33
Nico Huber15edd772023-07-01 18:16:50 +000034chmod -R a-w /etc/nginx/certs/ /etc/nginx/conf.d/sa.conf /var/www/html/
Nico Huberd6528722023-07-01 14:38:39 +000035
36exec /docker-entrypoint.sh "$@"