Merge pull request #2609 from joshfng/add-config-log-path
Add install option for log path
This commit is contained in:
commit
25845ea1a5
|
@ -86,6 +86,8 @@ http_port = HTTP Port
|
||||||
http_port_helper = Port number which application will listen on.
|
http_port_helper = Port number which application will listen on.
|
||||||
app_url = Application URL
|
app_url = Application URL
|
||||||
app_url_helper = This affects HTTP/HTTPS clone URL and somewhere in email.
|
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.
|
||||||
|
|
||||||
optional_title = Optional Settings
|
optional_title = Optional Settings
|
||||||
email_title = Email Service Settings
|
email_title = Email Service Settings
|
||||||
|
@ -122,6 +124,7 @@ run_user_not_match = Run user isn't the current user: %s -> %s
|
||||||
save_config_failed = Fail to save configuration: %v
|
save_config_failed = Fail to save configuration: %v
|
||||||
invalid_admin_setting = Admin account setting is invalid: %v
|
invalid_admin_setting = Admin account setting is invalid: %v
|
||||||
install_success = Welcome! We're glad that you chose Gogs, have fun and take care.
|
install_success = Welcome! We're glad that you chose Gogs, have fun and take care.
|
||||||
|
invalid_log_root_path = Log root path is invalid: %v
|
||||||
|
|
||||||
[home]
|
[home]
|
||||||
uname_holder = Username or email
|
uname_holder = Username or email
|
||||||
|
|
|
@ -27,6 +27,7 @@ type InstallForm struct {
|
||||||
SSHPort int
|
SSHPort int
|
||||||
HTTPPort string `binding:"Required"`
|
HTTPPort string `binding:"Required"`
|
||||||
AppUrl string `binding:"Required"`
|
AppUrl string `binding:"Required"`
|
||||||
|
LogRootPath string `binding:"Required"`
|
||||||
|
|
||||||
SMTPHost string
|
SMTPHost string
|
||||||
SMTPFrom string
|
SMTPFrom string
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -154,6 +154,7 @@ func Install(ctx *middleware.Context) {
|
||||||
form.SSHPort = setting.SSHPort
|
form.SSHPort = setting.SSHPort
|
||||||
form.HTTPPort = setting.HttpPort
|
form.HTTPPort = setting.HttpPort
|
||||||
form.AppUrl = setting.AppUrl
|
form.AppUrl = setting.AppUrl
|
||||||
|
form.LogRootPath = setting.LogRootPath
|
||||||
|
|
||||||
// E-mail service settings
|
// E-mail service settings
|
||||||
if setting.MailService != nil {
|
if setting.MailService != nil {
|
||||||
|
@ -241,6 +242,14 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test log root path.
|
||||||
|
form.LogRootPath = strings.Replace(form.LogRootPath, "\\", "/", -1)
|
||||||
|
if err := os.MkdirAll(form.LogRootPath, os.ModePerm); err != nil {
|
||||||
|
ctx.Data["Err_LogRootPath"] = true
|
||||||
|
ctx.RenderWithErr(ctx.Tr("install.invalid_log_root_path", err), INSTALL, &form)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Check run user.
|
// Check run user.
|
||||||
curUser := user.CurrentUsername()
|
curUser := user.CurrentUsername()
|
||||||
if form.RunUser != curUser {
|
if form.RunUser != curUser {
|
||||||
|
@ -329,6 +338,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
|
||||||
|
|
||||||
cfg.Section("log").Key("MODE").SetValue("file")
|
cfg.Section("log").Key("MODE").SetValue("file")
|
||||||
cfg.Section("log").Key("LEVEL").SetValue("Info")
|
cfg.Section("log").Key("LEVEL").SetValue("Info")
|
||||||
|
cfg.Section("log").Key("ROOT_PATH").SetValue(form.LogRootPath)
|
||||||
|
|
||||||
cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
|
cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
|
||||||
cfg.Section("security").Key("SECRET_KEY").SetValue(base.GetRandomString(15))
|
cfg.Section("security").Key("SECRET_KEY").SetValue(base.GetRandomString(15))
|
||||||
|
|
|
@ -109,6 +109,12 @@
|
||||||
<input id="app_url" name="app_url" value="{{.app_url}}" placeholder="e.g. https://try.gogs.io" required>
|
<input id="app_url" name="app_url" value="{{.app_url}}" placeholder="e.g. https://try.gogs.io" required>
|
||||||
<span class="help">{{.i18n.Tr "install.app_url_helper"}}</span>
|
<span class="help">{{.i18n.Tr "install.app_url_helper"}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inline required field">
|
||||||
|
<label for="log_root_path">{{.i18n.Tr "install.log_root_path"}}</label>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
<!-- Optional Settings -->
|
<!-- Optional Settings -->
|
||||||
<h4 class="ui dividing header">{{.i18n.Tr "install.optional_title"}}</h4>
|
<h4 class="ui dividing header">{{.i18n.Tr "install.optional_title"}}</h4>
|
||||||
|
|
Loading…
Reference in New Issue