-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgen-env.sh
More file actions
executable file
·41 lines (37 loc) · 1.27 KB
/
Copy pathgen-env.sh
File metadata and controls
executable file
·41 lines (37 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Function to generate a random password
generate_random_string() {
length=$1
tr -dc A-Za-z0-9 </dev/urandom | head -c $length ; echo ''
}
generate_random_password() {
length=$1
tr -dc 'A-Za-z0-9!@#$%^&*()_+{}|:<>?~' </dev/urandom | head -c $length ; echo ''
}
# Variables
MYSQL_ROOT_PASSWORD=$(generate_random_string 12)
# Генерация значений по маске
MYSQL_DATABASE="corp_database"
MYSQL_USER="corp_u00$(generate_random_string 4)"
MYSQL_PASSWORD=$(generate_random_string 10)
UPLOAD_LIMIT="1G"
MAX_EXECUTION_TIME=300
# Creating .env file
cat << EOF > .env
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE=${MYSQL_DATABASE}
MYSQL_USER=${MYSQL_USER}
MYSQL_PASSWORD=${MYSQL_PASSWORD}
UPLOAD_LIMIT=${UPLOAD_LIMIT}
MAX_EXECUTION_TIME=${MAX_EXECUTION_TIME}
EOF
# Output credentials
echo "Your credentials have been generated and saved to the .env file:"
echo "--------------------------------------------------------------"
echo "MySQL Root Password: ${MYSQL_ROOT_PASSWORD}"
echo "MySQL Database: ${MYSQL_DATABASE}"
echo "MySQL User: ${MYSQL_USER}"
echo "MySQL Password: ${MYSQL_PASSWORD}"
echo "Upload Limit: ${UPLOAD_LIMIT}"
echo "Max Execution Time: ${MAX_EXECUTION_TIME}"
echo "--------------------------------------------------------------"