Skip to content

Commit

Permalink
DataRootFolder path now works even without the final slash
Browse files Browse the repository at this point in the history
Signed-off-by: Surax98 <[email protected]>
  • Loading branch information
Surax98 committed Jun 18, 2024
1 parent e6c5118 commit 6acde8d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/common/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/http"
"os"
"strconv"
"strings"

"k8s.io/client-go/kubernetes"

Expand Down Expand Up @@ -58,6 +59,14 @@ func NewInterLinkConfig() (InterLinkConfig, error) {
}
yaml.Unmarshal(yfile, &InterLinkConfigInst)

if !strings.HasSuffix(InterLinkConfigInst.DataRootFolder, "/") {
InterLinkConfigInst.DataRootFolder += "/"
}

if strings.HasPrefix(InterLinkConfigInst.DataRootFolder, "~") {
InterLinkConfigInst.DataRootFolder = strings.Replace(InterLinkConfigInst.DataRootFolder, "~", "$HOME", 1)
}

if os.Getenv("INTERLINKURL") != "" {
InterLinkConfigInst.Interlinkurl = os.Getenv("INTERLINKURL")
}
Expand Down

0 comments on commit 6acde8d

Please sign in to comment.