From 37a07e329725f066ef4636a1805680b68595cc9f Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Thu, 10 Jan 2019 15:44:02 +0200 Subject: [PATCH] Update setup utility with mysql db flavor --- setup/flavors/compose/mailu.env | 5 ++++- setup/static/render.js | 16 ++++++++++++++-- setup/templates/steps/database.html | 23 ++++++++++++----------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 29b1c124..bb500073 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -165,7 +165,10 @@ REJECT_UNLISTED_RECIPIENT={{ reject_unlisted_recipient }} # Database settings ################################### DB_FLAVOR={{ db_flavor }} -{% if postgresql == 'external' %} +{% if db_flavor == 'postgresql' and postgresql == 'internal' %} +DB_PW={{ secret(16) }} +{% endif %} +{% if postgresql == 'external' or db_flavor == 'mysql' %} DB_USER={{ db_user }} DB_PW={{ db_pw }} DB_URL={{ db_url }} diff --git a/setup/static/render.js b/setup/static/render.js index 2a265139..23afcbec 100644 --- a/setup/static/render.js +++ b/setup/static/render.js @@ -36,8 +36,10 @@ $(document).ready(function() { $(document).ready(function() { if ($("#database").val() == 'sqlite') { $("#postgres_db").hide(); - } else { + } else if ($("#database").val() == 'postgresql') { $("#postgres_db").show(); + } else if ($("#database").val() == 'mysql') { + $("#external_db").show(); } if ($('#external_psql').prop('checked')) { $("#external_db").show(); @@ -45,8 +47,18 @@ $(document).ready(function() { $("#database").click(function() { if (this.value == 'sqlite') { $("#postgres_db").hide(); - } else { + $("#external_db").hide(); + } else if (this.value == 'postgresql') { $("#postgres_db").show(); + $("#external_db").hide(); + $("#external_db").prop('checked', false); + } else if (this.value == 'mysql') { + $("#postgres_db").hide(); + $("#external_db").show(); + $("#db_user").prop('required',true); + $("#db_pw").prop('required',true); + $("#db_url").prop('required',true); + $("#db_name").prop('required',true); } }); $("#external_psql").change(function() { diff --git a/setup/templates/steps/database.html b/setup/templates/steps/database.html index 811be2e0..af5334cc 100644 --- a/setup/templates/steps/database.html +++ b/setup/templates/steps/database.html @@ -4,7 +4,7 @@
@@ -23,16 +23,17 @@
- + +