Skip to content

Commit 662f5db

Browse files
committed
feat: allow specifying password in a file with AUTH_PASS_FILE
1 parent e0bcbec commit 662f5db

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

entrypoint.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,19 @@ write_dma_auth () {
2828

2929
if [ -n "${AUTH_CONTENTS:+1}" ]; then
3030
printenv AUTH_CONTENTS > /etc/dma/auth.conf
31-
elif [ -n "${AUTH_PASS:+1}" ]; then
32-
echo "${AUTH_USER:?}|${AUTH_HOST:-$DMA_SMARTHOST}:${AUTH_PASS}" > /etc/dma/auth.conf
31+
elif [ -n "${AUTH_PASS:+1}${AUTH_PASS_FILE:+1}" ]; then
32+
{
33+
printf '%s|%s:' "${AUTH_USER:?}" "${AUTH_HOST:-$DMA_SMARTHOST}"
34+
if [ -n "${AUTH_PASS_FILE-}" ]; then
35+
{
36+
cat "$AUTH_PASS_FILE"
37+
# make sure there's a newline
38+
echo
39+
} | head -n 1
40+
else
41+
printenv AUTH_PASS
42+
fi
43+
} > /etc/dma/auth.conf
3344
else
3445
return 0
3546
fi

0 commit comments

Comments
 (0)