added password generator
This commit is contained in:
parent
bbb8ab9c13
commit
9fd870dee8
21
bin/password-generate-for-env.sh
Normal file
21
bin/password-generate-for-env.sh
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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)"
|
Reference in New Issue
Block a user