Update setup utility with mysql db flavor

master
Ionut Filip 6 years ago
parent 2b0a2d561b
commit 37a07e3297

@ -165,7 +165,10 @@ REJECT_UNLISTED_RECIPIENT={{ reject_unlisted_recipient }}
# Database settings # Database settings
################################### ###################################
DB_FLAVOR={{ db_flavor }} 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_USER={{ db_user }}
DB_PW={{ db_pw }} DB_PW={{ db_pw }}
DB_URL={{ db_url }} DB_URL={{ db_url }}

@ -36,8 +36,10 @@ $(document).ready(function() {
$(document).ready(function() { $(document).ready(function() {
if ($("#database").val() == 'sqlite') { if ($("#database").val() == 'sqlite') {
$("#postgres_db").hide(); $("#postgres_db").hide();
} else { } else if ($("#database").val() == 'postgresql') {
$("#postgres_db").show(); $("#postgres_db").show();
} else if ($("#database").val() == 'mysql') {
$("#external_db").show();
} }
if ($('#external_psql').prop('checked')) { if ($('#external_psql').prop('checked')) {
$("#external_db").show(); $("#external_db").show();
@ -45,8 +47,18 @@ $(document).ready(function() {
$("#database").click(function() { $("#database").click(function() {
if (this.value == 'sqlite') { if (this.value == 'sqlite') {
$("#postgres_db").hide(); $("#postgres_db").hide();
} else { $("#external_db").hide();
} else if (this.value == 'postgresql') {
$("#postgres_db").show(); $("#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() { $("#external_psql").change(function() {

@ -4,7 +4,7 @@
<label>Which database back end would you like to use?</label> <label>Which database back end would you like to use?</label>
<br/> <br/>
<select class="btn btn-primary dropdown-toggle" name="db_flavor" id="database"> <select class="btn btn-primary dropdown-toggle" name="db_flavor" id="database">
{% for dbflavor in ["sqlite", "postgresql"] %} {% for dbflavor in ["sqlite", "postgresql", "mysql"] %}
<option value="{{ dbflavor }}" >{{ dbflavor }}</option> <option value="{{ dbflavor }}" >{{ dbflavor }}</option>
{% endfor %} {% endfor %}
</select> </select>
@ -23,7 +23,9 @@
</label> </label>
</div> </div>
<br/> <br/>
</div>
<div class="form-group" id="external_db" style="display: none"> <div class="form-group" id="external_db" style="display: none">
<p>Set external database parameters</p>
<label>DB User</label> <label>DB User</label>
<input class="form-control" type="text" name="db_user" placeholder="Username" id="db_user"> <input class="form-control" type="text" name="db_user" placeholder="Username" id="db_user">
<label>Db Password</label> <label>Db Password</label>
@ -34,6 +36,5 @@
<input class="form-control" type="text" name="db_name" placeholder="Database Name" id="db_name"> <input class="form-control" type="text" name="db_name" placeholder="Database Name" id="db_name">
</div> </div>
</div> </div>
</div>
{% endcall %} {% endcall %}
Loading…
Cancel
Save