Remove KOMODO_HOST fallback from MOTD script

The script now derives KOMODO_HOST from Tailscale when compose.env
is inaccessible to non-root users
This commit is contained in:
Damien
2026-06-14 15:33:22 +02:00
parent 8d8b821ae4
commit c8de4bdce5

View File

@@ -374,8 +374,6 @@ write_motd() {
# install time.
cat > /etc/profile.d/00-komodo.sh <<'MOTD'
KOMODO_DIR="${KOMODO_DIR:-/opt/komodo}"
KOMODO_HOST=$(awk -F= '$1 == "KOMODO_HOST" { print $2; exit }' "${KOMODO_DIR}/compose.env" 2>/dev/null)
[ -z "$KOMODO_HOST" ] && KOMODO_HOST="https://<not-set>"
TS_FQDN=$(tailscale status --json 2>/dev/null | awk -F'"' '
/"Self"/ { in_self=1 }
@@ -383,6 +381,11 @@ TS_FQDN=$(tailscale status --json 2>/dev/null | awk -F'"' '
')
[ -z "$TS_FQDN" ] && TS_FQDN="$(hostname).ts.net"
# compose.env is root-only (chmod 600); when this MOTD runs as a non-root user
# the awk read returns empty, so fall back to the Tailscale-derived FQDN.
KOMODO_HOST=$(awk -F= '$1 == "KOMODO_HOST" { print $2; exit }' "${KOMODO_DIR}/compose.env" 2>/dev/null)
[ -z "$KOMODO_HOST" ] && KOMODO_HOST="https://${TS_FQDN}"
CORE_STATE=$(docker inspect -f '{{.State.Status}}' komodo-core-1 2>/dev/null || echo "missing")
PERI_STATE=$(docker inspect -f '{{.State.Status}}' komodo-periphery-1 2>/dev/null || echo "missing")
MONGO_STATE=$(docker inspect -f '{{.State.Status}}' komodo-mongo-1 2>/dev/null || echo "missing")