mirror of https://github.com/gogs/gogs.git
install: able to enable console mode (#3119)
parent
171f97868d
commit
2d4dc544be
|
@ -82,6 +82,8 @@ app_url = Application URL
|
|||
app_url_helper = This affects HTTP/HTTPS clone URL and somewhere in email.
|
||||
log_root_path = Log Path
|
||||
log_root_path_helper = Directory to write log files to.
|
||||
enable_console_mode = Enable Console Mode
|
||||
enable_console_mode_popup = In addition to file mode, also print logs to console.
|
||||
|
||||
optional_title = Optional Settings
|
||||
email_title = Email Service Settings
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -29,6 +29,7 @@ type Install struct {
|
|||
HTTPPort string `binding:"Required"`
|
||||
AppUrl string `binding:"Required"`
|
||||
LogRootPath string `binding:"Required"`
|
||||
EnableConsoleMode bool
|
||||
|
||||
SMTPHost string
|
||||
SMTPFrom string
|
||||
|
|
|
@ -888,7 +888,7 @@ footer .ui.language .menu {
|
|||
width: 320px !important;
|
||||
}
|
||||
.install form input {
|
||||
width: 35% !important;
|
||||
width: 300px !important;
|
||||
}
|
||||
.install form .field {
|
||||
text-align: left;
|
||||
|
@ -897,17 +897,16 @@ footer .ui.language .menu {
|
|||
margin-left: 335px !important;
|
||||
}
|
||||
.install form .field.optional .title {
|
||||
margin-left: 38%;
|
||||
margin-left: 320px !important;
|
||||
}
|
||||
.install .ui .checkbox {
|
||||
margin-left: 40% !important;
|
||||
.install .ui.checkbox {
|
||||
margin-left: 335px !important;
|
||||
}
|
||||
.install .ui .checkbox label {
|
||||
.install .ui.checkbox label {
|
||||
width: auto !important;
|
||||
}
|
||||
.install #use-builtin-ssh-server {
|
||||
.install .inline.checkbox {
|
||||
margin-top: -1em;
|
||||
margin-left: -15px !important;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
.form .help {
|
||||
|
|
|
@ -204,76 +204,6 @@ function initCommentForm() {
|
|||
selectItem('.select-assignee', '#assignee_id');
|
||||
}
|
||||
|
||||
function initInstall() {
|
||||
if ($('.install').length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Database type change detection.
|
||||
$("#db_type").change(function () {
|
||||
var sqliteDefault = 'data/gogs.db';
|
||||
|
||||
var dbType = $(this).val();
|
||||
if (dbType === "SQLite3") {
|
||||
$('#sql_settings').hide();
|
||||
$('#pgsql_settings').hide();
|
||||
$('#sqlite_settings').show();
|
||||
|
||||
if (dbType === "SQLite3") {
|
||||
$('#db_path').val(sqliteDefault);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var dbDefaults = {
|
||||
"MySQL": "127.0.0.1:3306",
|
||||
"PostgreSQL": "127.0.0.1:5432",
|
||||
"MSSQL": "127.0.0.1, 1433"
|
||||
};
|
||||
|
||||
$('#sqlite_settings').hide();
|
||||
$('#sql_settings').show();
|
||||
$('#pgsql_settings').toggle(dbType === "PostgreSQL");
|
||||
$.each(dbDefaults, function(type, defaultHost) {
|
||||
if ($('#db_host').val() == defaultHost) {
|
||||
$('#db_host').val(dbDefaults[dbType]);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: better handling of exclusive relations.
|
||||
$('#offline-mode input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#disable-gravatar').checkbox('check');
|
||||
$('#federated-avatar-lookup').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#disable-gravatar input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#federated-avatar-lookup').checkbox('uncheck');
|
||||
} else {
|
||||
$('#offline-mode').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#federated-avatar-lookup input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#disable-gravatar').checkbox('uncheck');
|
||||
$('#offline-mode').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#disable-registration input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#enable-captcha').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#enable-captcha input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#disable-registration').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initRepository() {
|
||||
if ($('.repository').length == 0) {
|
||||
return;
|
||||
|
@ -1424,7 +1354,6 @@ $(document).ready(function () {
|
|||
searchRepositories();
|
||||
|
||||
initCommentForm();
|
||||
initInstall();
|
||||
initRepository();
|
||||
initWikiForm();
|
||||
initEditForm();
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
.install {
|
||||
@input-padding: 320px !important;
|
||||
|
||||
padding-top: 45px;
|
||||
padding-bottom: @footer-margin * 2;
|
||||
form {
|
||||
@input-padding: 320px !important;
|
||||
label {
|
||||
text-align: right;
|
||||
width: @input-padding;
|
||||
}
|
||||
input {
|
||||
width: 35% !important;
|
||||
width: 300px !important;
|
||||
}
|
||||
.field {
|
||||
text-align: left;
|
||||
|
@ -16,21 +17,18 @@
|
|||
margin-left: @input-padding+15px;
|
||||
}
|
||||
&.optional .title {
|
||||
margin-left: 38%;
|
||||
margin-left: @input-padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ui {
|
||||
.checkbox {
|
||||
margin-left: 40% !important;
|
||||
label {
|
||||
width: auto !important;
|
||||
}
|
||||
.ui.checkbox {
|
||||
margin-left: @input-padding+15px;
|
||||
label {
|
||||
width: auto !important;
|
||||
}
|
||||
}
|
||||
#use-builtin-ssh-server {
|
||||
.inline.checkbox {
|
||||
margin-top: -1em;
|
||||
margin-left: -15px !important;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -335,7 +335,11 @@ func InstallPost(ctx *context.Context, f form.Install) {
|
|||
|
||||
cfg.Section("session").Key("PROVIDER").SetValue("file")
|
||||
|
||||
cfg.Section("log").Key("MODE").SetValue("file")
|
||||
mode := "file"
|
||||
if f.EnableConsoleMode {
|
||||
mode = "console, file"
|
||||
}
|
||||
cfg.Section("log").Key("MODE").SetValue(mode)
|
||||
cfg.Section("log").Key("LEVEL").SetValue("Info")
|
||||
cfg.Section("log").Key("ROOT_PATH").SetValue(f.LogRootPath)
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<input id="ssh_port" name="ssh_port" value="{{.ssh_port}}">
|
||||
<span class="help">{{.i18n.Tr "install.ssh_port_helper"}}</span>
|
||||
</div>
|
||||
<div class="inline field" id="use-builtin-ssh-server">
|
||||
<div class="inline field checkbox">
|
||||
<div class="ui checkbox">
|
||||
<label class="poping up" data-content="{{.i18n.Tr "install.use_builtin_ssh_server_popup"}}"><strong>{{.i18n.Tr "install.use_builtin_ssh_server"}}</strong></label>
|
||||
<input name="use_builtin_ssh_server" type="checkbox" {{if .use_builtin_ssh_server}}checked{{end}}>
|
||||
|
@ -120,6 +120,12 @@
|
|||
<input id="log_root_path" name="log_root_path" value="{{.log_root_path}}" placeholder="log" required>
|
||||
<span class="help">{{.i18n.Tr "install.log_root_path_helper"}}</span>
|
||||
</div>
|
||||
<div class="inline field checkbox">
|
||||
<div class="ui checkbox">
|
||||
<label class="poping up" data-content="{{.i18n.Tr "install.enable_console_mode_popup"}}"><strong>{{.i18n.Tr "install.enable_console_mode"}}</strong></label>
|
||||
<input name="enable_console_mode" type="checkbox" {{if .enable_console_mode}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Optional Settings -->
|
||||
|
@ -247,4 +253,70 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Database type change detection.
|
||||
$("#db_type").change(function () {
|
||||
var sqliteDefault = 'data/gogs.db';
|
||||
|
||||
var dbType = $(this).val();
|
||||
if (dbType === "SQLite3") {
|
||||
$('#sql_settings').hide();
|
||||
$('#pgsql_settings').hide();
|
||||
$('#sqlite_settings').show();
|
||||
|
||||
if (dbType === "SQLite3") {
|
||||
$('#db_path').val(sqliteDefault);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var dbDefaults = {
|
||||
"MySQL": "127.0.0.1:3306",
|
||||
"PostgreSQL": "127.0.0.1:5432",
|
||||
"MSSQL": "127.0.0.1, 1433"
|
||||
};
|
||||
|
||||
$('#sqlite_settings').hide();
|
||||
$('#sql_settings').show();
|
||||
$('#pgsql_settings').toggle(dbType === "PostgreSQL");
|
||||
$.each(dbDefaults, function(type, defaultHost) {
|
||||
if ($('#db_host').val() == defaultHost) {
|
||||
$('#db_host').val(dbDefaults[dbType]);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: better handling of exclusive relations.
|
||||
$('#offline-mode input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#disable-gravatar').checkbox('check');
|
||||
$('#federated-avatar-lookup').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#disable-gravatar input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#federated-avatar-lookup').checkbox('uncheck');
|
||||
} else {
|
||||
$('#offline-mode').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#federated-avatar-lookup input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#disable-gravatar').checkbox('uncheck');
|
||||
$('#offline-mode').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#disable-registration input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#enable-captcha').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
$('#enable-captcha input').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#disable-registration').checkbox('uncheck');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{{template "base/footer" .}}
|
||||
|
|
Loading…
Reference in New Issue