From ae35af1a0de89264d2b81b00228a52686194f678 Mon Sep 17 00:00:00 2001 From: Rohit Amarnath <88762+ramarnat@users.noreply.github.com> Date: Tue, 23 Sep 2025 13:33:56 -0400 Subject: [PATCH] fix: update password hashing command in setup.sh for correct path resolution - Modified the password hashing command in setup.sh to change the working directory to /app before executing the hash-password script. This ensures that the NODE_PATH is correctly set, allowing the script to locate the necessary modules. This change improves the reliability of user creation by ensuring that password hashing operates correctly within the expected environment. --- packages/db/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/db/setup.sh b/packages/db/setup.sh index 0b2263957..54fc42e49 100644 --- a/packages/db/setup.sh +++ b/packages/db/setup.sh @@ -32,7 +32,7 @@ if [ -f "$USERS_FILE" ] && [ -z "${NO_DEMO_USER}" ]; then # Generate password hash echo "Creating user: $email" - HASH_OUTPUT=$(node /usr/local/bin/hash-password.js "$password" 2>&1) + HASH_OUTPUT=$(cd /app && NODE_PATH=/app/node_modules node /usr/local/bin/hash-password.js "$password" 2>&1) PASSWORD_HASH=$(echo "$HASH_OUTPUT" | grep "^Hash: " | sed 's/^Hash: //') if [ -z "$PASSWORD_HASH" ]; then @@ -61,7 +61,7 @@ elif [ -z "${NO_DEMO_USER}" ]; then # Generate hash from plaintext if provided if [ -n "$DEMO_USER_PASSWORD" ]; then - HASH_OUTPUT=$(node /usr/local/bin/hash-password.js "$DEMO_USER_PASSWORD" 2>&1) + HASH_OUTPUT=$(cd /app && NODE_PATH=/app/node_modules node /usr/local/bin/hash-password.js "$DEMO_USER_PASSWORD" 2>&1) DEMO_PASSWORD_HASH=$(echo "$HASH_OUTPUT" | grep "^Hash: " | sed 's/^Hash: //') else DEMO_PASSWORD_HASH=${DEMO_USER_PASSWORD_HASH:-'$2a$10$41G6b1BDUdxNjH1QFPJYDOM29EE0C9nTdjD1FoseuQ8vZU1NWtrh6'}