31 lines
1.2 KiB
Bash
31 lines
1.2 KiB
Bash
|
#!/bin/bash
|
||
|
# Change db passwords originally set in init script on first run
|
||
|
# rootpass arg sort of half works
|
||
|
|
||
|
source ../.env
|
||
|
|
||
|
if [[ $1 == "rootpass" ]] ; then
|
||
|
echo "New:"$DOTENV_MYSQL_ROOT_PASSWORD" Old:"$DOTENV_MYSQL_ROOT_PASSWORD_OLD
|
||
|
echo "Changing root db passwords in 5 seconds..."
|
||
|
sleep 6
|
||
|
docker-compose exec db mariadb --database=mysql -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD_OLD -e "ALTER USER 'root' IDENTIFIED BY '"$DOTENV_MYSQL_ROOT_PASSWORD"';"
|
||
|
docker-compose exec db mariadb --database=mysql -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '"$DOTENV_MYSQL_ROOT_PASSWORD"';"
|
||
|
docker-compose exec db mariadb --database=mysql -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD -e "FLUSH PRIVILEGES;"
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
|
||
|
echo "Changing app db passwords in 5 seconds..."
|
||
|
sleep 6
|
||
|
|
||
|
# Flask
|
||
|
docker-compose exec db mariadb --database=mysql -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD_OLD -e "ALTER USER 'flasku' IDENTIFIED BY '"$DOTENV_MYSQL_FLASK_PASSWORD"';"
|
||
|
|
||
|
# Gitea
|
||
|
docker-compose exec db mariadb --database=mysql -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD_OLD -e "ALTER USER 'gitea' IDENTIFIED BY '"$DOTENV_MYSQL_GITEA_PASSWORD"';"
|
||
|
|
||
|
|
||
|
docker-compose exec db mariadb --database=mysql -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD_OLD -e "FLUSH PRIVILEGES;"
|
||
|
|
||
|
|