mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-04-15 11:56:45 +02:00
* move to old package * go mod * remove old * refactor done * Update pkg/vault/oidc.go Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> * commit suggestions Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> * commit suggestions Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> * commit suggestions --------- Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
24 lines
486 B
Go
24 lines
486 B
Go
package vault
|
|
|
|
import (
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
func sanitizePath(path string) string {
|
|
path = strings.TrimSpace(path)
|
|
path = strings.TrimPrefix(path, "/")
|
|
path = strings.TrimSuffix(path, "/")
|
|
return path
|
|
}
|
|
|
|
func addPrefixToKvPath(p, mountPath, apiPrefix string) string {
|
|
switch {
|
|
case p == mountPath, p == strings.TrimSuffix(mountPath, "/"):
|
|
return path.Join(mountPath, apiPrefix)
|
|
default:
|
|
p = strings.TrimPrefix(p, mountPath)
|
|
return path.Join(mountPath, apiPrefix, p)
|
|
}
|
|
}
|