修复目录权限问题

This commit is contained in:
ryan
2026-06-22 23:21:04 +08:00
parent 8ed91dbf97
commit 49eae80c78
6 changed files with 57 additions and 2 deletions
+5 -1
View File
@@ -292,8 +292,12 @@ func renderOpenRestyCacheTemplateBlock(cfg ConfigSnapshot) string {
lines = append(lines, renderOpenRestyObservabilityTemplateBlock())
return strings.Join(lines, "")
}
cachePath := strings.TrimSpace(cfg.CachePath)
if cachePath == "" || strings.HasPrefix(cachePath, "/var/") {
cachePath = ProxyCachePathPlaceholder
}
lines = append(lines, strings.Join([]string{
fmt.Sprintf(" proxy_cache_path %s levels=%s keys_zone=openflare_cache:10m inactive=%s max_size=%s;", cfg.CachePath, cfg.CacheLevels, cfg.CacheInactive, cfg.CacheMaxSize),
fmt.Sprintf(" proxy_cache_path %s levels=%s keys_zone=openflare_cache:10m inactive=%s max_size=%s;", cachePath, cfg.CacheLevels, cfg.CacheInactive, cfg.CacheMaxSize),
fmt.Sprintf(" proxy_cache_key \"%s\";", cfg.CacheKeyTemplate),
fmt.Sprintf(" proxy_cache_lock %s;", onOff(cfg.CacheLockEnabled)),
fmt.Sprintf(" proxy_cache_lock_timeout %s;", cfg.CacheLockTimeout),
+1
View File
@@ -9,6 +9,7 @@ const (
ErrorLogPlaceholder = "__OPENFLARE_ERROR_LOG__"
PIDPathPlaceholder = "__OPENFLARE_PID_PATH__"
NginxCacheDirPlaceholder = "__OPENFLARE_NGINX_CACHE_DIR__"
ProxyCachePathPlaceholder = "__OPENFLARE_PROXY_CACHE_PATH__"
LuaDirPlaceholder = "__OPENFLARE_LUA_DIR__"
ObservabilityListenPlaceholder = "__OPENFLARE_OBSERVABILITY_LISTEN__"
ObservabilityPortPlaceholder = "__OPENFLARE_OBSERVABILITY_PORT__"