Skip to content

Commit 460b79c

Browse files
committed
Check validations right away
1 parent 8fe5411 commit 460b79c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/entrypoint.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/bin/sh
22

3-
# Listen for "docker stop": https://superuser.com/a/1299463/57662
4-
# shellcheck disable=SC3048
5-
trap "echo Shutdown requested; exit 0" SIGTERM
3+
# Validate required environment variables
4+
for var in CLOUDFLARE_API_TOKEN CERTBOT_DOMAINS CERTBOT_EMAIL CERTBOT_KEY_TYPE; do
5+
if [ -z "$(eval echo \$$var)" ]; then
6+
echo "Error: $var environment variable is not set"
7+
exit 1
8+
fi
9+
done
610

711
# Permissions must be created after volumes have been mounted; otherwise, windows file system permissions will override
812
# the permissions set within the container.
@@ -33,14 +37,6 @@ echo "⏰ Renewal Interval: $RENEWAL_INTERVAL seconds"
3337
echo "Let's Encrypt, shall we?"
3438
echo "-----------------------------------------------------------"
3539

36-
# Validate required environment variables
37-
for var in CLOUDFLARE_API_TOKEN CERTBOT_DOMAINS CERTBOT_EMAIL CERTBOT_KEY_TYPE; do
38-
if [ -z "$(eval echo \$$var)" ]; then
39-
echo "Error: $var environment variable is not set"
40-
exit 1
41-
fi
42-
done
43-
4440
# Create Cloudflare configuration file
4541
echo "dns_cloudflare_api_token = $CLOUDFLARE_API_TOKEN" > /cloudflare.ini
4642

0 commit comments

Comments
 (0)