[优化] 添加错误日志路径占位符并更新相关逻辑

This commit is contained in:
ryan
2026-05-31 21:26:45 +08:00
parent 80dd5f8b31
commit 796bf1c22f
5 changed files with 24 additions and 0 deletions
@@ -393,6 +393,8 @@ func (m *Manager) CurrentChecksum() (string, error) {
}
if accessLogPath := m.accessLogRuntimePath(); accessLogPath != "" {
normalizedMain = strings.ReplaceAll(normalizedMain, accessLogPath, openrestyrender.AccessLogPlaceholder)
errorLogPath := filepath.Join(filepath.Dir(accessLogPath), "error.log")
normalizedMain = strings.ReplaceAll(normalizedMain, filepath.ToSlash(errorLogPath), openrestyrender.ErrorLogPlaceholder)
}
if luaDir := m.luaRuntimePath(); luaDir != "" {
normalizedMain = strings.ReplaceAll(normalizedMain, luaDir, openrestyrender.LuaDirPlaceholder)
@@ -1061,6 +1063,8 @@ func (m *Manager) renderMainConfig(content string) string {
}
if accessLogPath := m.accessLogRuntimePath(); accessLogPath != "" {
rendered = strings.ReplaceAll(rendered, openrestyrender.AccessLogPlaceholder, accessLogPath)
errorLogPath := filepath.Join(filepath.Dir(accessLogPath), "error.log")
rendered = strings.ReplaceAll(rendered, openrestyrender.ErrorLogPlaceholder, filepath.ToSlash(errorLogPath))
}
if luaDir := m.luaRuntimePath(); luaDir != "" {
rendered = strings.ReplaceAll(rendered, openrestyrender.LuaDirPlaceholder, luaDir)