mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 21:10:51 +08:00
feat(managementasset): add MANAGEMENT_STATIC_PATH override
This commit is contained in:
@@ -56,6 +56,14 @@ type releaseResponse struct {
|
|||||||
|
|
||||||
// StaticDir resolves the directory that stores the management control panel asset.
|
// StaticDir resolves the directory that stores the management control panel asset.
|
||||||
func StaticDir(configFilePath string) string {
|
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)
|
configFilePath = strings.TrimSpace(configFilePath)
|
||||||
if configFilePath == "" {
|
if configFilePath == "" {
|
||||||
return ""
|
return ""
|
||||||
@@ -74,6 +82,14 @@ func StaticDir(configFilePath string) string {
|
|||||||
|
|
||||||
// FilePath resolves the absolute path to the management control panel asset.
|
// FilePath resolves the absolute path to the management control panel asset.
|
||||||
func FilePath(configFilePath string) string {
|
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)
|
dir := StaticDir(configFilePath)
|
||||||
if dir == "" {
|
if dir == "" {
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user