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

25 lines
725 B
Plaintext
Raw Normal View History

2017-09-04 14:00:44 +00:00
#!/usr/bin/with-contenv sh
cd /var/lib/postgresql
2017-09-04 14:10:39 +00:00
SAN_DOMAINS=$(/bin/concat-sans)
2017-09-04 14:00:44 +00:00
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}" \
2017-09-04 14:10:39 +00:00
--domains="${POSTGRES_DOMAIN}" ${SAN_DOMAINS} \
2017-09-04 14:00:44 +00:00
--dns="${POSTGRES_DNS_PROVIDER}" \
renew --days 30
fi