Open WebUI rehearsal: coreapp shell sources /coreapp/env.sh

Settings an upstream image's entrypoint builds from the Core's (a
database URL) go in /coreapp/env.sh, which the entrypoint sources and
coreapp shell now sources too, for one command and interactively.

Skill: that file; apps that migrate only inside the server; a pending
role isn't read-only; a never-shown password when an app insists on one;
keep the admin trigger when sso is dropped; $TMPDIR differs for any
command outside the sandbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 13:32:43 -07:00
co-authored by Claude Opus 5.5
parent 114b364cef
commit b855fd53f4
6 changed files with 53 additions and 12 deletions
+6 -2
View File
@@ -371,12 +371,16 @@ cmd_shell() {
load_app
core "docker exec $NAME sh -c : > /dev/null 2>&1" \
|| die "Can't run a shell in $NAME: it isn't running (coreapp status, coreapp logs), or its image has no sh (images built FROM scratch or distroless). coreapp logs shows its output."
# Settings an entrypoint builds from the Core's (a database URL) are in
# /coreapp/env.sh, if the image has it: the entrypoint sources it, and
# so does the shell, so the app's own tools get them here too
local env='[ -r /coreapp/env.sh ] && . /coreapp/env.sh; '
if [[ $# -gt 0 ]]; then
# One command, without a terminal, so scripts and agents can use it:
# coreapp shell 'ls -l /data'
core "docker exec $NAME sh -c $(printf '%q' "$*")"
core "docker exec $NAME sh -c $(printf '%q' "$env$*")"
else
core_tty "docker exec -it $NAME sh -c 'command -v bash > /dev/null && exec bash || exec sh'"
core_tty "docker exec -it $NAME sh -c $(printf '%q' "${env}command -v bash > /dev/null && exec bash || exec sh")"
fi
}