Skip to content

Commit

Permalink
Support Docker containers with more than one IP address
Browse files Browse the repository at this point in the history
Before we would fail if there where more than one.
  • Loading branch information
arnested committed Jan 30, 2025
1 parent f7f6c33 commit f2fb361
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 4 additions & 3 deletions context/base/docker-entrypoint.d/20-certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ CERT_KEY="/cert/${FIRST_VIRTUAL_HOST:-localhost}.key"
CA_CERT="/rootCA/rootCA.pem"
CA_KEY="/rootCA/rootCA-key.pem"

IP_ADDRESS=$(hostname -i)
export IP_ADDRESS

envsubst </etc/https-proxy/cert.cfg.template >/tmp/cert.cfg

for host in ${VIRTUAL_HOST:-localhost}; do
echo "dns_name = $host" >>/tmp/cert.cfg
done

for ip_address in $(hostname -i); do
echo "ip_address = $ip_address" >>/tmp/cert.cfg
done

certtool --generate-privkey --outfile "${CERT_KEY}"

if [ ! -r "${CA_CERT}" ] || [ ! -r "${CA_KEY}" ]; then
Expand Down
1 change: 0 additions & 1 deletion context/base/etc/https-proxy/cert.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ organization = "Development certificate"
unit = "${HOSTNAME}"
cn = "${FIRST_VIRTUAL_HOST}"
expiration_days = ${EXPIRATION_DAYS}
ip_address = "${IP_ADDRESS}"

0 comments on commit f2fb361

Please sign in to comment.