mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-14 02:34:22 +02:00
Updated setup with optional psql db
This commit is contained in:
parent
e668d360e8
commit
ef6a0727ac
@ -13,6 +13,16 @@ services:
|
||||
restart: always
|
||||
volumes:
|
||||
- "{{ root }}/redis:/data"
|
||||
|
||||
{% if db_flavor == 'postgresql' and postgresql == 'internal' %}
|
||||
database:
|
||||
image: ${DOCKER_ORG:-mailu}/postgresql:${MAILU_VERSION:-{{ version }}}
|
||||
restart: always
|
||||
env_file: {{ env }}
|
||||
volumes:
|
||||
- "{{ root }}/data/psql_db:/data"
|
||||
- "{{ root }}/data/psql_backup:/backup"
|
||||
{% endif %}
|
||||
|
||||
# Core services
|
||||
front:
|
||||
|
@ -158,3 +158,15 @@ REAL_IP_FROM={{ real_ip_from }}
|
||||
|
||||
# choose wether mailu bounces (no) or rejects (yes) mail when recipient is unknown (value: yes, no)
|
||||
REJECT_UNLISTED_RECIPIENT={{ reject_unlisted_recipient }}
|
||||
|
||||
###################################
|
||||
# Advanced settings
|
||||
###################################
|
||||
DB_FLAVOR = {{ db_flavor }}
|
||||
{% if postgresql == 'external' %}
|
||||
DB_USER={{ db_user }}
|
||||
DB_PW={{ db_pw }}
|
||||
DB_URL={{ db_url }}
|
||||
DB_NAME={{ db_name }}
|
||||
{% endif %}
|
||||
|
||||
|
@ -31,4 +31,46 @@ $(document).ready(function() {
|
||||
$("#admin_path").attr("value", "");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
if ($("#database").val() == 'sqlite') {
|
||||
$("#postgres_db").hide();
|
||||
} else {
|
||||
$("#postgres_db").show();
|
||||
}
|
||||
if ($('#external_psql').prop('checked')) {
|
||||
$("#external_db").show();
|
||||
}
|
||||
$("#database").click(function() {
|
||||
if (this.value == 'sqlite') {
|
||||
$("#postgres_db").hide();
|
||||
} else {
|
||||
$("#postgres_db").show();
|
||||
}
|
||||
});
|
||||
$("#external_psql").change(function() {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#external_db").show();
|
||||
$("#db_user").prop('required',true);
|
||||
$("#db_pw").prop('required',true);
|
||||
$("#db_url").prop('required',true);
|
||||
$("#db_name").prop('required',true);
|
||||
} else {
|
||||
$("#external_db").hide();
|
||||
}
|
||||
});
|
||||
$("#internal_psql").change(function() {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#external_db").hide();
|
||||
$("#db_user").val("");
|
||||
$("#db_pw").val("");
|
||||
$("#db_url").val("");
|
||||
$("#db_name").val("");
|
||||
$("#db_user").prop('required',false);
|
||||
$("#db_pw").prop('required',false);
|
||||
$("#db_url").prop('required',false);
|
||||
$("#db_name").prop('required',false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
39
setup/templates/steps/database.html
Normal file
39
setup/templates/steps/database.html
Normal file
@ -0,0 +1,39 @@
|
||||
{% call macros.panel("info", "Database preferences") %}
|
||||
|
||||
<div class="form-group">
|
||||
<label>Which database back end would you like to use?</label>
|
||||
<br/>
|
||||
<select class="btn btn-primary dropdown-toggle" name="db_flavor" id="database">
|
||||
{% for dbflavor in ["sqlite", "postgresql"] %}
|
||||
<option value="{{ dbflavor }}" >{{ dbflavor }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<p></p>
|
||||
<div id="postgres_db" style="display: none">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="postgresql" id="internal_psql" value="internal" checked>
|
||||
<label class="form-check-label" for="internal_psql">
|
||||
Use the Postgresql from Mailu
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="postgresql" value="external" id="external_psql" >
|
||||
<label class="form-check-label" for="external_psql">
|
||||
I want to connect to an external database
|
||||
</label>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-group" id="external_db" style="display: none">
|
||||
<label>DB User</label>
|
||||
<input class="form-control" type="text" name="db_user" placeholder="Username" id="db_user">
|
||||
<label>Db Password</label>
|
||||
<input class="form-control" type="password" name="db_pw" placeholder="Password" id="db_pw">
|
||||
<label>Db URL</label>
|
||||
<input class="form-control" type="text" name="db_url" placeholder="URL" id="db_url">
|
||||
<label>Db Name</label>
|
||||
<input class="form-control" type="text" name="db_name" placeholder="Database Name" id="db_name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endcall %}
|
@ -19,6 +19,7 @@
|
||||
{%for file in steps %}
|
||||
{% include "steps/" + flavor + "/" + file %}
|
||||
{% endfor %}
|
||||
{% include "steps/database.html" %}
|
||||
<input class="btn btn-primary" type="submit" value="Setup Mailu">
|
||||
{% endif %}
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user