Skip to content

Commit c75e524

Browse files
committed
feat(managementasset): add MANAGEMENT_STATIC_PATH override
1 parent f58d0fa commit c75e524

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/managementasset/updater.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ type releaseResponse struct {
5656

5757
// StaticDir resolves the directory that stores the management control panel asset.
5858
func StaticDir(configFilePath string) string {
59+
if override := strings.TrimSpace(os.Getenv("MANAGEMENT_STATIC_PATH")); override != "" {
60+
cleaned := filepath.Clean(override)
61+
if strings.EqualFold(filepath.Base(cleaned), managementAssetName) {
62+
return filepath.Dir(cleaned)
63+
}
64+
return cleaned
65+
}
66+
5967
configFilePath = strings.TrimSpace(configFilePath)
6068
if configFilePath == "" {
6169
return ""
@@ -74,6 +82,14 @@ func StaticDir(configFilePath string) string {
7482

7583
// FilePath resolves the absolute path to the management control panel asset.
7684
func FilePath(configFilePath string) string {
85+
if override := strings.TrimSpace(os.Getenv("MANAGEMENT_STATIC_PATH")); override != "" {
86+
cleaned := filepath.Clean(override)
87+
if strings.EqualFold(filepath.Base(cleaned), managementAssetName) {
88+
return cleaned
89+
}
90+
return filepath.Join(cleaned, ManagementFileName)
91+
}
92+
7793
dir := StaticDir(configFilePath)
7894
if dir == "" {
7995
return ""

0 commit comments

Comments
 (0)