]> source.dussan.org Git - gitea.git/commitdiff
modules/setting: simple behave change in startup
authorUnknwon <u@gogs.io>
Fri, 27 Feb 2015 00:45:38 +0000 (19:45 -0500)
committerUnknwon <u@gogs.io>
Fri, 27 Feb 2015 00:45:38 +0000 (19:45 -0500)
.bra.toml
modules/base/template.go
modules/setting/setting.go
routers/install.go

index 65b39884458da06e35d87b1dc100a62854c1aca7..0f52fcdde5f218c3a6f022a6e24fd58176dd78f6 100644 (file)
--- a/.bra.toml
+++ b/.bra.toml
@@ -1,6 +1,6 @@
 [run]
 init_cmds = [
-       ["grep", "-rn", "FIXME", "."],
+       #["grep", "-rn", "FIXME", "."],
        ["./gogs", "web"]
 ]
 watch_all = true
index cfcabb71a20a4ab2e2cdf8752bae664dc2ac317a..196b935107a13e0a060a1a8a2cacf116de247171 100644 (file)
@@ -164,7 +164,7 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
        },
        "DiffTypeToStr":     DiffTypeToStr,
        "DiffLineTypeToStr": DiffLineTypeToStr,
-       "Sha1":              Sha1,
+       "Sha1":              Sha1,
        "ShortSha":          ShortSha,
        "Md5":               EncodeMd5,
        "ActionContent2Commits": ActionContent2Commits,
index 6a36105691f663a2645c84cea0afe4539a7c9b94..6db43b16b3d6455bd479fa75b191e48b1004943e 100644 (file)
@@ -272,10 +272,6 @@ func NewConfigContext() {
                "StampNano":   time.StampNano,
        }[Cfg.Section("time").Key("FORMAT").MustString("RFC1123")]
 
-       if err = os.MkdirAll(AttachmentPath, os.ModePerm); err != nil {
-               log.Fatal(4, "Could not create directory %s: %s", AttachmentPath, err)
-       }
-
        RunUser = Cfg.Section("").Key("RUN_USER").String()
        curUser := os.Getenv("USER")
        if len(curUser) == 0 {
@@ -298,9 +294,6 @@ func NewConfigContext() {
        } else {
                RepoRootPath = filepath.Clean(RepoRootPath)
        }
-       if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
-               log.Fatal(4, "Fail to create repository root path(%s): %v", RepoRootPath, err)
-       }
        ScriptType = sec.Key("SCRIPT_TYPE").MustString("bash")
 
        sec = Cfg.Section("picture")
@@ -309,7 +302,6 @@ func NewConfigContext() {
        if !filepath.IsAbs(AvatarUploadPath) {
                AvatarUploadPath = path.Join(workDir, AvatarUploadPath)
        }
-       os.MkdirAll(AvatarUploadPath, os.ModePerm)
        switch sec.Key("GRAVATAR_SOURCE").MustString("gravatar") {
        case "duoshuo":
                GravatarSource = "http://gravatar.duoshuo.com/avatar/"
@@ -374,9 +366,11 @@ func newLogService() {
                        log.Fatal(4, "Unknown log mode: %s", mode)
                }
 
+               validLevels := []string{"Trace", "Debug", "Info", "Warn", "Error", "Critical"}
                // Log level.
-               levelName := Cfg.Section("log."+mode).Key("LEVEL").In("Trace",
-                       []string{"Trace", "Debug", "Info", "Warn", "Error", "Critical"})
+               levelName := Cfg.Section("log."+mode).Key("LEVEL").In(
+                       Cfg.Section("log").Key("LEVEL").In("Trace", validLevels),
+                       validLevels)
                level, ok := logLevels[levelName]
                if !ok {
                        log.Fatal(4, "Unknown log level: %s", levelName)
index a7828e351c790786b2d5f0a6aa034dedc8228049..4aa3ca930642d62308810831835983d7a75e07ba 100644 (file)
@@ -224,6 +224,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
        cfg.Section("session").Key("PROVIDER").SetValue("file")
 
        cfg.Section("log").Key("MODE").SetValue("file")
+       cfg.Section("log").Key("LEVEL").SetValue("Info")
 
        cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
        cfg.Section("security").Key("SECRET_KEY").SetValue(base.GetRandomString(15))