deploy.sh: extract CADDY_BASICAUTH_HASH via grep/cut, not by sourcing .env
Sourcing the .env in a set -u shell dies on the bcrypt hash's $2 expansion. grep/cut pulls the value without any shell interpretation.
This commit is contained in:
+4
-2
@@ -124,8 +124,10 @@ if [ '${COPY_SHARED[$TARGET]}' = '1' ]; then
|
||||
cp shared/alloy/config.alloy /opt/alloy/config/config.alloy
|
||||
|
||||
echo ' Rendering Caddyfile (basicauth hash from .env)...'
|
||||
set -a; . ./.env; set +a
|
||||
if [ -z \"\${CADDY_BASICAUTH_HASH:-}\" ]; then
|
||||
# Extract the hash with grep/cut rather than sourcing .env: sourcing a
|
||||
# bcrypt value in a set -u shell dies on its dollar-sign expansion.
|
||||
CADDY_BASICAUTH_HASH=\"\$(grep -E '^CADDY_BASICAUTH_HASH=' .env | tail -1 | cut -d= -f2-)\"
|
||||
if [ -z \"\${CADDY_BASICAUTH_HASH}\" ]; then
|
||||
echo ' WARN: CADDY_BASICAUTH_HASH not set in .env; keeping placeholder'
|
||||
else
|
||||
# '|' delimiter: the bcrypt hash contains '/' characters.
|
||||
|
||||
Reference in New Issue
Block a user