add direnv

This commit is contained in:
Jason Swank
2026-01-20 15:28:00 +00:00
parent b152fc3e7a
commit 92a48b1628
2 changed files with 16 additions and 1 deletions

View File

@@ -6,7 +6,7 @@ RUN apk -U --no-cache add \
doas doas-sudo-shim \ doas doas-sudo-shim \
bash less openvi \ bash less openvi \
coreutils grep gawk perl \ coreutils grep gawk perl \
curl bind-tools curl direnv bind-tools
RUN adduser -h /home/cli -s /bin/bash -D cli cli && \ RUN adduser -h /home/cli -s /bin/bash -D cli cli && \
addgroup cli wheel && \ addgroup cli wheel && \

View File

@@ -0,0 +1,15 @@
export_secret() {
local name="$1"
local file="/run/secrets/${name}"
if [[ ! -f "$file" ]]; then
printf "secret file not found: %s\n" $file >&2
return 1
fi
# Read first line, remove trailing spaces/tabs, convert nulls to newlines
local value
value=$(head -n1 "$file" | sed 's/[ \t]*$//' | tr '\0' '\n')
export "${name}=${value}"
}