feat(managementasset): add MANAGEMENT_STATIC_PATH override

This commit is contained in:
hkfires
2025-10-16 21:52:59 +08:00
parent f58d0faf8c
commit c75e524fe5

View File

@@ -56,6 +56,14 @@ type releaseResponse struct {
// StaticDir resolves the directory that stores the management control panel asset.
func StaticDir(configFilePath string) string {
if override := strings.TrimSpace(os.Getenv("MANAGEMENT_STATIC_PATH")); override != "" {
cleaned := filepath.Clean(override)
if strings.EqualFold(filepath.Base(cleaned), managementAssetName) {
return filepath.Dir(cleaned)
}
return cleaned
}
configFilePath = strings.TrimSpace(configFilePath)
if configFilePath == "" {
return ""
@@ -74,6 +82,14 @@ func StaticDir(configFilePath string) string {
// FilePath resolves the absolute path to the management control panel asset.
func FilePath(configFilePath string) string {
if override := strings.TrimSpace(os.Getenv("MANAGEMENT_STATIC_PATH")); override != "" {
cleaned := filepath.Clean(override)
if strings.EqualFold(filepath.Base(cleaned), managementAssetName) {
return cleaned
}
return filepath.Join(cleaned, ManagementFileName)
}
dir := StaticDir(configFilePath)
if dir == "" {
return ""