Add `./docker.sh db` helper to easily access database.

This commit is contained in:
Buster "Silver Eagle" Neece 2020-11-13 00:20:02 -06:00
parent 582b8faef9
commit 49d128a0b4
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
1 changed files with 27 additions and 0 deletions

View File

@ -431,6 +431,33 @@ bash() {
exit
}
#
# Enter the MariaDB database management terminal with the correct credentials.
#
db() {
local MYSQL_HOST MYSQL_PORT MYSQL_USER MYSQL_PASSWORD MYSQL_DATABASE
.env --file azuracast.env get MYSQL_HOST
MYSQL_HOST="${REPLY:-mariadb}"
.env --file azuracast.env get MYSQL_PORT
MYSQL_PORT="${REPLY:-mariadb}"
.env --file azuracast.env get MYSQL_USER
MYSQL_USER="${REPLY:-azuracast}"
.env --file azuracast.env get MYSQL_PASSWORD
MYSQL_PASSWORD="${REPLY:-azur4c457}"
.env --file azuracast.env get MYSQL_DATABASE
MYSQL_DATABASE="${REPLY:-azuracast}"
docker-compose run --rm mariadb mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} \
--host=${MYSQL_HOST} --port=${MYSQL_PORT} --database=${MYSQL_DATABASE}
exit
}
#
# Back up the Docker volumes to a .tar.gz file.
# Usage: