Skip to content

Commit

Permalink
Update caddy.go
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub authored Nov 16, 2023
1 parent 1640e79 commit 63542f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions application/library/caddy/caddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (

"github.com/admpub/nging/v5/application/library/config"
"github.com/admpub/nging/v5/application/library/msgbox"
"github.com/admpub/nging/v5/application/library/common"
)

const UnsupportedPathInfo = `unsupported-nging-default-webserver-config`
Expand Down Expand Up @@ -80,21 +81,22 @@ func SetDefaults(c *Config) {
if len(c.CPU) == 0 {
c.CPU = DefaultConfig.CPU
}
pidFile := `data` + echo.FilePathSeparator + `pid`
pidFile := filepath.Join(echo.Wd(), `data` + echo.FilePathSeparator + `pid`)
err := com.MkdirAll(pidFile, os.ModePerm)
if err != nil {
log.Println(err)
}
pidFile = filepath.Join(pidFile, `caddy.pid`)
c.PidFile = pidFile
if len(c.LogFile) == 0 {
logFile := `data` + echo.FilePathSeparator + `logs`
logFile := filepath.Join(echo.Wd(), `data` + echo.FilePathSeparator + `logs`)
err := com.MkdirAll(logFile, os.ModePerm)
if err != nil {
log.Println(err)
}
c.LogFile = filepath.Join(logFile, `caddy.log`)
} else {
c.LogFile = common.OSAbsPath(c.LogFile)
err := com.MkdirAll(filepath.Dir(c.LogFile), os.ModePerm)
if err != nil {
log.Println(err)
Expand Down

0 comments on commit 63542f4

Please sign in to comment.