Fix wrong serve command log location and commit repo action
This commit is contained in:
Родитель
09e7e76204
Коммит
197c4d4a5b
|
@ -59,7 +59,7 @@ func (a Action) GetContent() string {
|
|||
// CommitRepoAction records action for commit repository.
|
||||
func CommitRepoAction(userId int64, userName string,
|
||||
repoId int64, repoName string, refName string, commits *base.PushCommits) error {
|
||||
log.Trace("action.CommitRepoAction: %d/%s", userId, repoName)
|
||||
log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName)
|
||||
|
||||
bs, err := json.Marshal(commits)
|
||||
if err != nil {
|
||||
|
@ -92,8 +92,8 @@ func CommitRepoAction(userId int64, userName string,
|
|||
})
|
||||
if err != nil {
|
||||
log.Error("action.CommitRepoAction(notify watches): %d/%s", userId, repoName)
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Update repository last update time.
|
||||
|
@ -107,6 +107,8 @@ func CommitRepoAction(userId int64, userName string,
|
|||
log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repoName)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ var Service struct {
|
|||
ResetPwdCodeLives int
|
||||
}
|
||||
|
||||
func exeDir() (string, error) {
|
||||
func ExecDir() (string, error) {
|
||||
file, err := exec.LookPath(os.Args[0])
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -244,7 +244,7 @@ func newNotifyMailService() {
|
|||
|
||||
func NewConfigContext() {
|
||||
//var err error
|
||||
workDir, err := exeDir()
|
||||
workDir, err := ExecDir()
|
||||
if err != nil {
|
||||
fmt.Printf("Fail to get work directory: %s\n", err)
|
||||
os.Exit(2)
|
||||
|
|
|
@ -73,7 +73,7 @@ func RepoAssignment(redirect bool) martini.Handler {
|
|||
if base.EnableHttpsClone {
|
||||
scheme = "https"
|
||||
}
|
||||
ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, user.LowerName, repo.LowerName)
|
||||
ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
|
||||
ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s://%s/%s/%s.git", scheme, base.Domain, user.LowerName, repo.LowerName)
|
||||
|
||||
ctx.Data["IsRepositoryValid"] = true
|
||||
|
|
6
serve.go
6
serve.go
|
@ -45,10 +45,10 @@ gogs serv provide access auth for repositories`,
|
|||
Flags: []cli.Flag{},
|
||||
}
|
||||
|
||||
func init() {
|
||||
func newLogger(execDir string) {
|
||||
level := "0"
|
||||
os.MkdirAll("log", os.ModePerm)
|
||||
log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, "log/serv.log"))
|
||||
log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, execDir+"/log/serv.log"))
|
||||
log.Trace("start logging...")
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,8 @@ func In(b string, sl map[string]int) bool {
|
|||
}
|
||||
|
||||
func runServ(k *cli.Context) {
|
||||
execDir, _ := base.ExecDir()
|
||||
newLogger(execDir)
|
||||
log.Trace("new serv request " + log.Mode + ":" + log.Config)
|
||||
|
||||
base.NewConfigContext()
|
||||
|
|
Загрузка…
Ссылка в новой задаче