diff options
author | Unknwon <u@gogs.io> | 2015-02-26 19:45:38 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-02-26 19:45:38 -0500 |
commit | e3dece1371f38f5af72c200bc4c4684ec2fc396b (patch) | |
tree | 5cf9eb5aabffb405f37a00a7c2bb1fe44c8e2493 /modules | |
parent | 8896c82d34ec5d86af1eeafb8c55a06f81bd3af1 (diff) | |
download | gitea-e3dece1371f38f5af72c200bc4c4684ec2fc396b.tar.gz gitea-e3dece1371f38f5af72c200bc4c4684ec2fc396b.zip |
modules/setting: simple behave change in startup
Diffstat (limited to 'modules')
-rw-r--r-- | modules/base/template.go | 2 | ||||
-rw-r--r-- | modules/setting/setting.go | 14 |
2 files changed, 5 insertions, 11 deletions
diff --git a/modules/base/template.go b/modules/base/template.go index cfcabb71a2..196b935107 100644 --- a/modules/base/template.go +++ b/modules/base/template.go @@ -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, diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 6a36105691..6db43b16b3 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -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) |