From 1cf81720d6869b5326640d1b9c08b16ea3692733 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 10 Mar 2025 16:04:27 +0100 Subject: [PATCH] get user password --- install/npm-plus-install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/install/npm-plus-install.sh b/install/npm-plus-install.sh index 2db92cb..a779ee2 100644 --- a/install/npm-plus-install.sh +++ b/install/npm-plus-install.sh @@ -61,5 +61,21 @@ msg_info "Starting NPM Plus" docker compose up -d msg_ok "Started NPM Plus" +msg_info "Get Default Login" +CONTAINER_ID=$(docker ps --format "{{.ID}}" --filter "name=npmplus") +TIMEOUT=30 +while [[ $TIMEOUT -gt 0 ]]; do + PASSWORD_LINE=$(docker logs "$CONTAINER_ID" 2>&1 | grep "Creating a new user: admin@example.org with password:") + + if [[ -n "$PASSWORD_LINE" ]]; then + PASSWORD=$(echo "$PASSWORD_LINE" | awk '{print $NF}') + echo -e "username: admin@example.org\npassword: $PASSWORD" >/opt/.npm_pwd + exit 0 + fi + + sleep 2 + ((TIMEOUT--)) +done + motd_ssh customize