diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-08-05 15:24:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 15:24:49 +0200 |
commit | 4f513474dce9788bead4799fefe2ed2fdfa75213 (patch) | |
tree | a061c8ee8a94b0f5de28c39c06d7c5117678cd4d /cmd/web.go | |
parent | Remove backslashed newlines on markdown (#26344) (diff) | |
download | forgejo-4f513474dce9788bead4799fefe2ed2fdfa75213.tar.xz forgejo-4f513474dce9788bead4799fefe2ed2fdfa75213.zip |
Improve CLI and messages (#26341)
Follow the CLI refactoring
1. Remove the "checkCommandFlags" helper
2. Unify the web startup message, make them have consistent names as `./gitea help`
3. Fine tune some other messages (see the diff)
Diffstat (limited to 'cmd/web.go')
-rw-r--r-- | cmd/web.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/cmd/web.go b/cmd/web.go index dfe2091d06..b69769ec43 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -107,13 +107,18 @@ func createPIDFile(pidPath string) { } } -func serveInstall(ctx *cli.Context) error { +func showWebStartupMessage(msg string) { log.Info("Gitea version: %s%s", setting.AppVer, setting.AppBuiltWith) - log.Info("App path: %s", setting.AppPath) - log.Info("Work path: %s", setting.AppWorkPath) - log.Info("Custom path: %s", setting.CustomPath) - log.Info("Config file: %s", setting.CustomConf) - log.Info("Prepare to run install page") + log.Info("* RunMode: %s", setting.RunMode) + log.Info("* AppPath: %s", setting.AppPath) + log.Info("* WorkPath: %s", setting.AppWorkPath) + log.Info("* CustomPath: %s", setting.CustomPath) + log.Info("* ConfigFile: %s", setting.CustomConf) + log.Info("%s", msg) +} + +func serveInstall(ctx *cli.Context) error { + showWebStartupMessage("Prepare to run install page") routers.InitWebInstallPage(graceful.GetManager().HammerContext()) @@ -150,29 +155,24 @@ func serveInstalled(ctx *cli.Context) error { setting.LoadCommonSettings() setting.MustInstalled() - log.Info("Gitea version: %s%s", setting.AppVer, setting.AppBuiltWith) - log.Info("App path: %s", setting.AppPath) - log.Info("Work path: %s", setting.AppWorkPath) - log.Info("Custom path: %s", setting.CustomPath) - log.Info("Config file: %s", setting.CustomConf) - log.Info("Run mode: %s", setting.RunMode) - log.Info("Prepare to run web server") + showWebStartupMessage("Prepare to run web server") if setting.AppWorkPathMismatch { log.Error("WORK_PATH from config %q doesn't match other paths from environment variables or command arguments. "+ - "Only WORK_PATH in config should be set and used. Please remove the other outdated work paths from environment variables and command arguments", setting.CustomConf) + "Only WORK_PATH in config should be set and used. Please make sure the path in config file is correct, "+ + "remove the other outdated work paths from environment variables and command arguments", setting.CustomConf) } rootCfg := setting.CfgProvider if rootCfg.Section("").Key("WORK_PATH").String() == "" { saveCfg, err := rootCfg.PrepareSaving() if err != nil { - log.Error("Unable to prepare saving WORK_PATH=%s to config %q: %v\nYou must set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err) + log.Error("Unable to prepare saving WORK_PATH=%s to config %q: %v\nYou should set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err) } else { rootCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath) saveCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath) if err = saveCfg.Save(); err != nil { - log.Error("Unable to update WORK_PATH=%s to config %q: %v\nYou must set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err) + log.Error("Unable to update WORK_PATH=%s to config %q: %v\nYou should set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err) } } } |