@willbooster/wb 21.1.0 → 21.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +39 -41
- package/docker/bash/apply-docker-env.sh +2 -17
- package/package.json +1 -1
|
@@ -11,38 +11,23 @@ fi
|
|
|
11
11
|
# command, passing only keys absent from the inherited environment, so build args and
|
|
12
12
|
# platform-injected runtime values — including deliberately empty ones — always win over the
|
|
13
13
|
# baked defaults (colon-less `${KEY=...}` semantics).
|
|
14
|
-
# An explicitly configured path must exist: silently starting without the baked configuration
|
|
15
|
-
# would be the very silent-degradation mode this helper exists to prevent.
|
|
16
|
-
if [[ -n "${DOCKER_ENV_PATH:-}" && ! -f "$DOCKER_ENV_PATH" ]]; then
|
|
17
|
-
echo "apply-docker-env.sh: DOCKER_ENV_PATH=$DOCKER_ENV_PATH does not exist." >&2
|
|
18
|
-
exit 1
|
|
19
|
-
fi
|
|
20
14
|
|
|
21
15
|
# Inherited environment variables that share this script's internal names (they are all valid
|
|
22
16
|
# baked keys too) would be clobbered by the parsing below, so their original values are queued
|
|
23
17
|
# as leading `env` assignments — placed after the baked ones, they always win. Direct
|
|
24
18
|
# parameter expansion (not command substitution) preserves trailing newlines in the values.
|
|
25
19
|
if printenv env_path > /dev/null; then set -- "env_path=${env_path:-}" "$@"; fi
|
|
26
|
-
if printenv candidate > /dev/null; then set -- "candidate=${candidate:-}" "$@"; fi
|
|
27
20
|
if printenv line > /dev/null; then set -- "line=${line:-}" "$@"; fi
|
|
28
21
|
if printenv key > /dev/null; then set -- "key=${key:-}" "$@"; fi
|
|
29
22
|
if printenv value > /dev/null; then set -- "value=${value:-}" "$@"; fi
|
|
30
23
|
if printenv assignments > /dev/null; then set -- "assignments=${assignments:-}" "$@"; fi
|
|
31
24
|
|
|
32
|
-
env_path
|
|
33
|
-
if [[ -z "$env_path" ]]; then
|
|
34
|
-
for candidate in ./.docker.env ./.env; do
|
|
35
|
-
if [[ -f "$candidate" ]]; then
|
|
36
|
-
env_path="$candidate"
|
|
37
|
-
break
|
|
38
|
-
fi
|
|
39
|
-
done
|
|
40
|
-
fi
|
|
25
|
+
env_path=./.docker.env
|
|
41
26
|
|
|
42
27
|
# The applied values are handed to the child via `env` instead of shell assignments, so Bash
|
|
43
28
|
# readonly names (UID, EUID, ...) are valid baked keys.
|
|
44
29
|
assignments=()
|
|
45
|
-
if [[ -
|
|
30
|
+
if [[ -f "$env_path" ]]; then
|
|
46
31
|
# `|| [[ -n "$line" ]]` keeps a final line that lacks a trailing newline.
|
|
47
32
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
48
33
|
key="${line%%=*}"
|