postgres/rootfs/etc/cont-init.d/02-certificates

31 lines
798 B
Plaintext
Raw Normal View History

2017-09-04 14:00:44 +00:00
#!/usr/bin/with-contenv sh
cd /var/lib/postgresql
SAN_DOMAINS=""
export IFS=";"
for SAN in ${POSTGRES_SAN}
do
SAN_DOMAINS="${SAN_DOMAINS} --domains=\"${SAN}\""
done
if [ ! -f /var/lib/postgresql/.lego/certificates/${POSTGRES_DOMAIN}.crt ]; then
chown -R postgres /var/lib/postgresql/.lego
s6-setuidgid postgres lego \
--accept-tos \
--server="${POSTGRES_CA}" \
--email="${POSTGRES_ACME_EMAIL}" \
--domains="${POSTGRES_DOMAIN}" ${SAN_DOMAINS} \
--dns="${POSTGRES_DNS_PROVIDER}" \
run
else
s6-setuidgid postgres lego \
--accept-tos \
--server="${POSTGRES_CA}" \
--email="${POSTGRES_ACME_EMAIL}" \
--domains="${POSTGRES_DOMAIN}" \
--dns="${POSTGRES_DNS_PROVIDER}" \
renew --days 30
fi