#!/bin/bash echo "=================================" echo "MinIO WebUI Password Generator" echo "=================================" echo "" read -s -p "Enter password: " PASSWORD echo "" if [ -z "$PASSWORD" ] || [ ${#PASSWORD} -lt 8 ]; then echo "Error: Password must be at least 8 characters long." exit 1 fi echo "" echo "Generating password hash..." # Use the backend container to generate the hash HASH=$(docker run --rm -it node:20-alpine sh -c " npm install bcrypt >/dev/null 2>&1 && \ node -e \" const bcrypt = require('bcrypt'); bcrypt.hash('$PASSWORD', 12).then(hash => console.log(hash)); \" " | tr -d '\r') echo "" echo "=================================" echo "Password Hash Generated:" echo "=================================" echo "" echo "$HASH" echo "" echo "Add this to your .env file:" echo "ADMIN_PASSWORD_HASH=$HASH" echo "" echo "================================="