mirror of
https://gitee.com/gitea/gitea.git
synced 2024-12-26 15:52:57 +08:00
Install: Set the default host string based on database type
This commit is contained in:
parent
2401e68d7e
commit
494e5fd40c
@ -468,6 +468,9 @@ function initRepository() {
|
||||
function initInstall() {
|
||||
// database type change
|
||||
(function () {
|
||||
var mysql_default = '127.0.0.1:3306'
|
||||
var postgres_default = '127.0.0.1:5432'
|
||||
|
||||
$('#install-database').on("change", function () {
|
||||
var val = $(this).val();
|
||||
if (val != "SQLite3") {
|
||||
@ -475,6 +478,18 @@ function initInstall() {
|
||||
$('.sqlite-setting').addClass("hide");
|
||||
if (val == "PostgreSQL") {
|
||||
$('.pgsql-setting').removeClass("hide");
|
||||
|
||||
// Change the host value to the Postgres default, but only
|
||||
// if the user hasn't already changed it from the MySQL
|
||||
// default.
|
||||
if ($('#database-host').val() == mysql_default) {
|
||||
$('#database-host').val(postgres_default);
|
||||
}
|
||||
} else if (val == 'MySQL') {
|
||||
$('.pgsql-setting').addClass("hide");
|
||||
if ($('#database-host').val() == postgres_default) {
|
||||
$('#database-host').val(mysql_default);
|
||||
}
|
||||
} else {
|
||||
$('.pgsql-setting').addClass("hide");
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">Host: </label>
|
||||
<div class="col-md-8">
|
||||
<input name="host" class="form-control" placeholder="Type database server host" value="{{.host}}">
|
||||
<input name="host" id="database-host" class="form-control" placeholder="Type database server host" value="{{.host}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user