#!/bin/sh # elevenlabs.io/docker-entrypoint.sh # Generates Caddy access-control fragments from environment variables at container start. set -e CONF_DIR="/etc/caddy" MATCHERS="${CONF_DIR}/matchers.caddy" GUARD="${CONF_DIR}/guard.caddy" : > "${MATCHERS}" : > "${GUARD}" # --- 0. Required settings --- if [ -z "${DOMAIN}" ]; then echo "[entrypoint] FATAL: DOMAIN is not set (e.g. proxy.example.com)" >&2 exit 1 fi if [ -z "${ACME_EMAIL}" ]; then echo "[entrypoint] FATAL: ACME_EMAIL is not set — Let's Encrypt account needs it" >&2 exit 1 fi # --- 1. IP allowlist --- if [ -z "${ALLOWED_CIDR}" ]; then echo "[entrypoint] ALLOWED_CIDR is empty — allowing all IPs (dev mode)" else CIDR_LIST=$(echo "${ALLOWED_CIDR}" | tr ',' ' ' | tr -s ' ') cat >> "${MATCHERS}" <> "${GUARD}" <> "${MATCHERS}" <> "${GUARD}" <