updated file browser url logic
All checks were successful
Build and Push Docker Image / Build image (push) Successful in 1m40s
All checks were successful
Build and Push Docker Image / Build image (push) Successful in 1m40s
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
gerrors "errors"
|
||||
|
||||
"git.acooldomain.co/server-manager/backend/instancemanager"
|
||||
"git.acooldomain.co/server-manager/backend/models"
|
||||
servermanagerv1 "git.acooldomain.co/server-manager/kubernetes-operator/api/v1alpha1"
|
||||
@@ -355,6 +357,14 @@ func (i *InstanceManager) StopFileBrowser(ctx context.Context, serverId string)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (im *InstanceManager) GetServerIdFromFileBrowserUrl(ctx context.Context, url string) (string, error) {
|
||||
pathSegments := strings.Split(url, "/")
|
||||
if len(pathSegments) < 4 {
|
||||
return "", gerrors.New("invalid url")
|
||||
}
|
||||
return pathSegments[3], nil
|
||||
}
|
||||
|
||||
func NewInstanceManager(config models.KubernetesInstanceManagerConfig) (*InstanceManager, error) {
|
||||
c, err := rest.InClusterConfig()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user