Merge pull request #149 from JonasT/mysql-backend-autodetect

Add automatic rewrite of mysql:// database URLs to mysql+pymysql:// URLs.

Since `pymysql` is the recommended way to use MySQL with Core, it makes sense to automatically rewrite the initial part of the `$DATABASE_URL` to `mysql+pymysql` .
This commit is contained in:
Abhilash Raj
2017-10-02 15:56:33 -07:00
committed by GitHub

View File

@@ -58,6 +58,12 @@ function setup_database () {
exit 1
fi
# Translate mysql:// urls to mysql+mysql:// backend:
if [[ "$DATABASE_URL" == mysql://* ]]; then
DATABASE_URL="mysql+pymysql://${DATABASE_URL:8}"
echo "Database URL was automatically rewritten to: $DATABASE_URL"
fi
cat >> /etc/mailman.cfg <<EOF
[database]
class: $DATABASE_CLASS