This commit is contained in:
Unknown 2014-05-28 01:53:06 -04:00
parent ff690fd976
commit ab13a29cb5
13 changed files with 71 additions and 59 deletions

View File

@ -5,7 +5,7 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language
![Demo](http://gowalker.org/public/gogs_demo.gif)
##### Current version: 0.3.6 Alpha
##### Current version: 0.4.0 Alpha
### NOTICES

View File

@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。
![Demo](http://gowalker.org/public/gogs_demo.gif)
##### 当前版本0.3.6 Alpha
##### 当前版本0.4.0 Alpha
## 开发目的

View File

@ -88,7 +88,7 @@ func In(b string, sl map[string]int) bool {
}
func runServ(k *cli.Context) {
setup("log/serv.log")
setup(path.Join(setting.LogRootPath, "serv.log"))
keys := strings.Split(os.Args[2], "-")
if len(keys) != 2 {

View File

@ -6,12 +6,14 @@ package cmd
import (
"os"
"path"
"strconv"
"github.com/codegangsta/cli"
qlog "github.com/qiniu/log"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/setting"
)
var CmdUpdate = cli.Command{
@ -35,7 +37,7 @@ func runUpdate(c *cli.Context) {
return
}
setup("log/update.log")
setup(path.Join(setting.LogRootPath, "update.log"))
args := c.Args()
if len(args) != 3 {

View File

@ -4,4 +4,6 @@ This directory only used for development, and us [go-bindata](https://github.com
To apply any change in this directory, install [go-bindata](https://github.com/jteeuwen/go-bindata), and then execute following command in root of source directory:
```
$ go-bindata -ignore="\\.DS_Store|README.md" -o modules/bin/conf.go -pkg="bin" conf/...
```

View File

@ -171,6 +171,7 @@ SERVICE = server
DISABLE_GRAVATAR = false
[log]
ROOT_PATH =
; Either "console", "file", "conn", "smtp" or "database", default is "console"
; Use comma to separate multiple modes, e.g. "console, file"
MODE = console

View File

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.3.6.0525 Alpha"
const APP_VER = "0.4.0.0528 Alpha"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())

View File

@ -112,8 +112,7 @@ func SetEngine() (err error) {
// WARNNING: for serv command, MUST remove the output to os.stdout,
// so use log file to instead print to stdout.
workDir, _ := setting.WorkDir()
logPath := workDir + "/log/xorm.log"
logPath := path.Join(setting.LogRootPath, "xorm.log")
os.MkdirAll(path.Dir(logPath), os.ModePerm)
f, err := os.Create(logPath)

View File

@ -201,52 +201,52 @@ func conf_app_ini() ([]byte, error) {
0x71, 0x8d, 0xa7, 0x29, 0xaf, 0xf4, 0xe8, 0x52, 0xe2, 0x07, 0x91, 0x89,
0xe5, 0x4e, 0x40, 0x56, 0xfb, 0xb8, 0xcc, 0xbd, 0x71, 0xfa, 0x84, 0x48,
0xd5, 0x79, 0xd6, 0xbd, 0xff, 0x85, 0xbb, 0xd3, 0x7f, 0x5b, 0x9f, 0xd0,
0x3e, 0x35, 0x93, 0x40, 0xd5, 0x09, 0x35, 0xb3, 0x00, 0xa5, 0x1e, 0x83,
0x17, 0x9a, 0xd3, 0xf2, 0xee, 0x7a, 0x32, 0xde, 0xb9, 0xbe, 0x3e, 0x5b,
0x4e, 0x13, 0x70, 0x9f, 0x34, 0x0d, 0x49, 0x19, 0xc5, 0xf3, 0xd0, 0x3c,
0x4d, 0xa4, 0xa0, 0x14, 0x39, 0xbc, 0x8b, 0xde, 0x38, 0x54, 0x1d, 0x2e,
0xd5, 0xb1, 0x03, 0x13, 0xeb, 0x2d, 0xab, 0x9a, 0x50, 0xab, 0xd5, 0xff,
0x66, 0x63, 0xbf, 0xd3, 0xd3, 0x77, 0x8d, 0xaf, 0xd4, 0x8a, 0xfb, 0x05,
0xa0, 0x27, 0x35, 0x07, 0xfc, 0x6e, 0x39, 0xa7, 0x1f, 0x0e, 0xba, 0x2a,
0xfa, 0xfb, 0x21, 0x2c, 0x8c, 0xfe, 0x76, 0x51, 0xc8, 0x82, 0x7e, 0xf4,
0x31, 0xfd, 0x62, 0x58, 0xd9, 0x4d, 0x87, 0x25, 0x07, 0xeb, 0xca, 0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77, 0xa4, 0x26, 0x27, 0xf8, 0xd0, 0x24, 0xf1,
0x2a, 0x27, 0x7e, 0x6a, 0x1d, 0xfd, 0xdc, 0x78, 0x4a, 0x6d, 0x1d, 0xb4,
0x8e, 0xb7, 0xbe, 0x6f, 0xc9, 0x2e, 0xb6, 0x73, 0x63, 0xbb, 0x5e, 0x13,
0xba, 0x4d, 0x5e, 0xde, 0x85, 0xef, 0xe9, 0x59, 0x73, 0x03, 0xe1, 0xc0,
0xa5, 0xe3, 0xa6, 0x59, 0x87, 0x81, 0xe9, 0xef, 0x3f, 0x03, 0x00, 0x00,
0xff, 0xff, 0x77, 0x1f, 0xe2, 0xa5, 0x2d, 0x18, 0x00, 0x00,
},
"conf/app.ini",
)

View File

@ -62,6 +62,7 @@ var (
DisableGravatar bool
// Log settings.
LogRootPath string
LogModes []string
LogConfigs []string
@ -145,7 +146,8 @@ func NewConfigContext() {
SshPort = Cfg.MustInt("server", "SSH_PORT", 22)
OfflineMode = Cfg.MustBool("server", "OFFLINE_MODE")
DisableRouterLog = Cfg.MustBool("server", "DISABLE_ROUTER_LOG")
StaticRootPath = Cfg.MustValue("server", "STATIC_ROOT_PATH")
StaticRootPath = Cfg.MustValue("server", "STATIC_ROOT_PATH", workDir)
LogRootPath = Cfg.MustValue("log", "ROOT_PATH", path.Join(workDir, "log"))
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK")
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
@ -233,7 +235,7 @@ func newLogService() {
case "console":
LogConfigs[i] = fmt.Sprintf(`{"level":%s}`, level)
case "file":
logPath := Cfg.MustValue(modeSec, "FILE_NAME", "log/gogs.log")
logPath := Cfg.MustValue(modeSec, "FILE_NAME", path.Join(LogRootPath, "gogs.log"))
os.MkdirAll(path.Dir(logPath), os.ModePerm)
LogConfigs[i] = fmt.Sprintf(
`{"level":%s,"filename":"%s","rotate":%v,"maxlines":%d,"maxsize":%d,"daily":%v,"maxdays":%d}`, level,

View File

@ -185,6 +185,8 @@ func Config(ctx *middleware.Context) {
ctx.Data["RunUser"] = setting.RunUser
ctx.Data["RunMode"] = strings.Title(martini.Env)
ctx.Data["RepoRootPath"] = setting.RepoRootPath
ctx.Data["StaticRootPath"] = setting.StaticRootPath
ctx.Data["LogRootPath"] = setting.LogRootPath
ctx.Data["ScriptType"] = setting.ScriptType
ctx.Data["Service"] = setting.Service

View File

@ -1 +1 @@
0.3.6.0525 Alpha
0.4.0.0528 Alpha

View File

@ -30,6 +30,10 @@
<hr/>
<dt>Repository Root Path</dt>
<dd>{{.RepoRootPath}}</dd>
<dt>Static File Root Path</dt>
<dd>{{.StaticRootPath}}</dd>
<dt>Log File Root Path</dt>
<dd>{{.LogRootPath}}</dd>
<dt>Script Type</dt>
<dd>{{.ScriptType}}</dd>
</dl>