mirror of
https://github.com/go-gitea/gitea
synced 2025-01-05 07:24:25 +00:00
Fix settings not being loaded at CLI (#26402)
Closes #25898 The problem was that the default settings weren't being loaded --------- Signed-off-by: cassiozareck <cassiomilczareck@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
dafadf0028
commit
1e2c8eb494
@ -69,6 +69,10 @@ var microcmdUserCreate = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runCreateUser(c *cli.Context) error {
|
func runCreateUser(c *cli.Context) error {
|
||||||
|
// this command highly depends on the many setting options (create org, visibility, etc.), so it must have a full setting load first
|
||||||
|
// duplicate setting loading should be safe at the moment, but it should be refactored & improved in the future.
|
||||||
|
setting.LoadSettings()
|
||||||
|
|
||||||
if err := argsSet(c, "email"); err != nil {
|
if err := argsSet(c, "email"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
11
cmd/web.go
11
cmd/web.go
@ -12,6 +12,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
|
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
|
||||||
|
|
||||||
@ -115,6 +116,16 @@ func showWebStartupMessage(msg string) {
|
|||||||
log.Info("* CustomPath: %s", setting.CustomPath)
|
log.Info("* CustomPath: %s", setting.CustomPath)
|
||||||
log.Info("* ConfigFile: %s", setting.CustomConf)
|
log.Info("* ConfigFile: %s", setting.CustomConf)
|
||||||
log.Info("%s", msg) // show startup message
|
log.Info("%s", msg) // show startup message
|
||||||
|
|
||||||
|
if setting.CORSConfig.Enabled {
|
||||||
|
log.Info("CORS Service Enabled")
|
||||||
|
}
|
||||||
|
if setting.DefaultUILocation != time.Local {
|
||||||
|
log.Info("Default UI Location is %v", setting.DefaultUILocation.String())
|
||||||
|
}
|
||||||
|
if setting.MailService != nil {
|
||||||
|
log.Info("Mail Service Enabled: RegisterEmailConfirm=%v, Service.EnableNotifyMail=%v", setting.Service.RegisterEmailConfirm, setting.Service.EnableNotifyMail)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func serveInstall(ctx *cli.Context) error {
|
func serveInstall(ctx *cli.Context) error {
|
||||||
|
@ -5,8 +5,6 @@ package setting
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CORSConfig defines CORS settings
|
// CORSConfig defines CORS settings
|
||||||
@ -28,7 +26,4 @@ var CORSConfig = struct {
|
|||||||
|
|
||||||
func loadCorsFrom(rootCfg ConfigProvider) {
|
func loadCorsFrom(rootCfg ConfigProvider) {
|
||||||
mustMapSetting(rootCfg, "cors", &CORSConfig)
|
mustMapSetting(rootCfg, "cors", &CORSConfig)
|
||||||
if CORSConfig.Enabled {
|
|
||||||
log.Info("CORS Service Enabled")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func IndexerGlobFromString(globstr string) []*GlobMatcher {
|
|||||||
expr = strings.TrimSpace(expr)
|
expr = strings.TrimSpace(expr)
|
||||||
if expr != "" {
|
if expr != "" {
|
||||||
if g, err := GlobMatcherCompile(expr, '.', '/'); err != nil {
|
if g, err := GlobMatcherCompile(expr, '.', '/'); err != nil {
|
||||||
log.Info("Invalid glob expression '%s' (skipped): %v", expr, err)
|
log.Warn("Invalid glob expression '%s' (skipped): %v", expr, err)
|
||||||
} else {
|
} else {
|
||||||
extarr = append(extarr, g)
|
extarr = append(extarr, g)
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,6 @@ func loadMailerFrom(rootCfg ConfigProvider) {
|
|||||||
MailService.OverrideEnvelopeFrom = true
|
MailService.OverrideEnvelopeFrom = true
|
||||||
MailService.EnvelopeFrom = parsed.Address
|
MailService.EnvelopeFrom = parsed.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Mail Service Enabled")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadRegisterMailFrom(rootCfg ConfigProvider) {
|
func loadRegisterMailFrom(rootCfg ConfigProvider) {
|
||||||
@ -267,7 +265,6 @@ func loadRegisterMailFrom(rootCfg ConfigProvider) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Service.RegisterEmailConfirm = true
|
Service.RegisterEmailConfirm = true
|
||||||
log.Info("Register Mail Service Enabled")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadNotifyMailFrom(rootCfg ConfigProvider) {
|
func loadNotifyMailFrom(rootCfg ConfigProvider) {
|
||||||
@ -278,7 +275,6 @@ func loadNotifyMailFrom(rootCfg ConfigProvider) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Service.EnableNotifyMail = true
|
Service.EnableNotifyMail = true
|
||||||
log.Info("Notify Mail Service Enabled")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func tryResolveAddr(addr string) []net.IPAddr {
|
func tryResolveAddr(addr string) []net.IPAddr {
|
||||||
|
@ -73,6 +73,4 @@ func loadSessionFrom(rootCfg ConfigProvider) {
|
|||||||
SessionConfig.ProviderConfig = string(shadowConfig)
|
SessionConfig.ProviderConfig = string(shadowConfig)
|
||||||
SessionConfig.OriginalProvider = SessionConfig.Provider
|
SessionConfig.OriginalProvider = SessionConfig.Provider
|
||||||
SessionConfig.Provider = "VirtualSession"
|
SessionConfig.Provider = "VirtualSession"
|
||||||
|
|
||||||
log.Info("Session Service Enabled")
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ func loadTimeFrom(rootCfg ConfigProvider) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Load time zone failed: %v", err)
|
log.Fatal("Load time zone failed: %v", err)
|
||||||
}
|
}
|
||||||
log.Info("Default UI Location is %v", zone)
|
|
||||||
}
|
}
|
||||||
if DefaultUILocation == nil {
|
if DefaultUILocation == nil {
|
||||||
DefaultUILocation = time.Local
|
DefaultUILocation = time.Local
|
||||||
|
Loading…
Reference in New Issue
Block a user