Skip to content

Commit

Permalink
Merge function docker_generate_root_password into docker_setup_db
Browse files Browse the repository at this point in the history
  • Loading branch information
ltangvald authored and yosifkit committed Sep 18, 2019
1 parent 71962c5 commit ce4d14d
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions .template.Debian/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ docker_init_client_command() {

# Creates initial database users and schema
docker_setup_db() {
# Generate random root password
if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)"
mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
fi
# Sets root password and creates root users for non-localhost hosts
rootCreate=
# default root to listen for connections from anywhere
Expand Down Expand Up @@ -239,12 +244,6 @@ mysql_expire_root_user() {
fi
}

# Generate a random root password
docker_generate_root_password() {
export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)"
mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
}

# Load timezone info into database
docker_load_tzinfo() {
# sed is for https://bugs.mysql.com/bug.php?id=20545
Expand Down Expand Up @@ -285,10 +284,6 @@ _main() {
docker_load_tzinfo
fi

if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
docker_generate_root_password
fi

docker_setup_db

echo
Expand Down

0 comments on commit ce4d14d

Please sign in to comment.