This repository was archived by the owner on Feb 5, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ MAINTAINER Arne Jørgensen
33
44RUN set -x && \
55 apt-get update && \
6- DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang-go git php-cli php-curl ruby && \
6+ DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang-go git php-cli php-curl ruby python-pip && \
77 GOPATH=/usr/local go get -u github.com/xenolf/lego && \
88 curl -sS https://platform.sh/cli/installer | php && \
99 curl -sS -o /opt/yamledit.rb https://raw.githubusercontent.com/dbrandenburg/yamledit/e277715d71ed5bac17e97267577dd612fcc7ee2c/yamledit.rb && \
10- DEBIAN_FRONTEND=noninteractive apt-get purge -y -q golang-go && \
10+ pip install shyaml && \
11+ DEBIAN_FRONTEND=noninteractive apt-get purge -y -q golang-go python-pip && \
1112 apt-get clean -y -q && \
1213 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1314
Original file line number Diff line number Diff line change @@ -77,7 +77,19 @@ upload_certificate () {
7777 local cert=${TMPDIR} /cert-01
7878 local key=${LEGOPATH} /certificates/${domain} .key
7979 local chain=${TMPDIR} /cert-02
80- platform domain:update --yes --cert=${cert} --key=${key} --chain=${chain} --project=" ${PLATFORMSH_PROJECT_ID} " " ${domain} "
80+ local current=${TMPDIR} /current
81+
82+ # Compare certificate to current certificate at platform.sh. Only upload if they are different.
83+
84+ # We allow the following commands to fail because there might not be a current certificate.
85+ set -x
86+ platform domain:get --project=" ${PLATFORMSH_PROJECT_ID} " --property=ssl " ${domain} " | shyaml get-value certificate > " ${current} "
87+
88+ if [ " $( openssl x509 -in " ${cert} " -noout -fingerprint) " != " $( openssl x509 -in " ${current} " -noout -fingerprint) " ]; then
89+ platform domain:update --yes --cert=${cert} --key=${key} --chain=${chain} --project=" ${PLATFORMSH_PROJECT_ID} " " ${domain} "
90+ fi
91+
92+ set +x
8193}
8294
8395verify_preconditions && create_or_renew_domains && upload_certificates
You can’t perform that action at this time.
0 commit comments