blob: 05e17b4da54b04872844fb49c5e7c141e74a65c4 [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
Nico Hubere509ccd2023-07-21 15:14:12 +000032chown -R root:root /var/www/html/
Nico Huberd6528722023-07-01 14:38:39 +000033
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 "$@"