22 lines
624 B
Bash
22 lines
624 B
Bash
#!/bin/bash
|
|
|
|
# Function to generate a random password using passgen
|
|
generate_password() {
|
|
pwgen -cnsB1v 12
|
|
}
|
|
|
|
# Get the name of the current directory (project name)
|
|
PROJECT_NAME=$(basename "$(pwd)")
|
|
MYSQL_USER="${PROJECT_NAME}_joomla_user"
|
|
MYSQL_DATABASE="${PROJECT_NAME}_joomla_db"
|
|
|
|
echo "Generated passwords:"
|
|
|
|
# Generate passwords for specific variables and print them to CLI
|
|
echo "MYSQL_ROOT_PASSWORD=$(generate_password)"
|
|
echo "MYSQL_USER=$MYSQL_USER"
|
|
echo "MYSQL_DATABASE=$MYSQL_DATABASE"
|
|
echo "MYSQL_PASSWORD=$(generate_password)"
|
|
echo "MYSQL_DATABASE=$MYSQL_DATABASE"
|
|
echo "JOOMLA_PASSWORD=$(generate_password)"
|