From 2ae28fb0a75366bdcdb1eabe213ed21f2afeb7cf Mon Sep 17 00:00:00 2001 From: m1ngsama Date: Sat, 28 Feb 2026 02:04:26 +0800 Subject: [PATCH] fix: export .env vars with set -a so envsubst can see them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit source without set -a sets vars in current shell but does not export them. Child processes like envsubst cannot see unexported vars, causing all template substitutions to produce empty strings. Fix: set -a before source, set +a after — auto-exports every assigned var. --- services/email/deploy.sh | 2 +- services/frp/client/deploy.sh | 2 +- services/frp/server/deploy.sh | 2 +- services/nginx/deploy.sh | 2 +- services/shadowsocks/client/deploy.sh | 2 +- services/shadowsocks/server/deploy.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/email/deploy.sh b/services/email/deploy.sh index dcd0ca0..f4ae774 100755 --- a/services/email/deploy.sh +++ b/services/email/deploy.sh @@ -8,7 +8,7 @@ source "$SCRIPT_DIR/../../bin/lib/common.sh" ENV_FILE="${INFRA_DIR:-.}/.env" [ -f "$ENV_FILE" ] || { log_error "No .env found at $ENV_FILE"; exit 1; } -source "$ENV_FILE" +set -a; source "$ENV_FILE"; set +a require_env DOMAIN MAIL_HOST MAIL_USER diff --git a/services/frp/client/deploy.sh b/services/frp/client/deploy.sh index 8f6668c..55b747e 100755 --- a/services/frp/client/deploy.sh +++ b/services/frp/client/deploy.sh @@ -8,7 +8,7 @@ source "$SCRIPT_DIR/../../../bin/lib/common.sh" ENV_FILE="${INFRA_DIR:-.}/.env" [ -f "$ENV_FILE" ] || { log_error "No .env found at $ENV_FILE"; exit 1; } -source "$ENV_FILE" +set -a; source "$ENV_FILE"; set +a require_env FRP_SERVER_ADDR FRP_SERVER_PORT FRP_TOKEN diff --git a/services/frp/server/deploy.sh b/services/frp/server/deploy.sh index db57fff..dbe27b7 100755 --- a/services/frp/server/deploy.sh +++ b/services/frp/server/deploy.sh @@ -8,7 +8,7 @@ source "$SCRIPT_DIR/../../../bin/lib/common.sh" ENV_FILE="${INFRA_DIR:-.}/.env" [ -f "$ENV_FILE" ] || { log_error "No .env found at $ENV_FILE"; exit 1; } -source "$ENV_FILE" +set -a; source "$ENV_FILE"; set +a require_env FRP_TOKEN FRP_WEB_PASSWORD FRP_BIND_PORT diff --git a/services/nginx/deploy.sh b/services/nginx/deploy.sh index 5812945..f9c6d59 100755 --- a/services/nginx/deploy.sh +++ b/services/nginx/deploy.sh @@ -8,7 +8,7 @@ source "$SCRIPT_DIR/../../bin/lib/common.sh" ENV_FILE="${INFRA_DIR:-.}/.env" [ -f "$ENV_FILE" ] || { log_error "No .env found at $ENV_FILE"; exit 1; } -source "$ENV_FILE" +set -a; source "$ENV_FILE"; set +a require_env DOMAIN diff --git a/services/shadowsocks/client/deploy.sh b/services/shadowsocks/client/deploy.sh index f2aeca0..3a2d172 100755 --- a/services/shadowsocks/client/deploy.sh +++ b/services/shadowsocks/client/deploy.sh @@ -8,7 +8,7 @@ source "$SCRIPT_DIR/../../../bin/lib/common.sh" ENV_FILE="${INFRA_DIR:-.}/.env" [ -f "$ENV_FILE" ] || { log_error "No .env found at $ENV_FILE"; exit 1; } -source "$ENV_FILE" +set -a; source "$ENV_FILE"; set +a require_env SS_SERVER SS_PORT SS_PASSWORD SS_METHOD diff --git a/services/shadowsocks/server/deploy.sh b/services/shadowsocks/server/deploy.sh index dda0cf0..4f648a1 100755 --- a/services/shadowsocks/server/deploy.sh +++ b/services/shadowsocks/server/deploy.sh @@ -8,7 +8,7 @@ source "$SCRIPT_DIR/../../../bin/lib/common.sh" ENV_FILE="${INFRA_DIR:-.}/.env" [ -f "$ENV_FILE" ] || { log_error "No .env found at $ENV_FILE"; exit 1; } -source "$ENV_FILE" +set -a; source "$ENV_FILE"; set +a require_env SS_PORT SS_PASSWORD SS_METHOD