Skip to content

Commit 3038974

Browse files
committed
Add missing file
Signed-off-by: Kevin Fox <Kevin.Fox@pnnl.gov>
1 parent 8866619 commit 3038974

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package common
2+
3+
import (
4+
"os"
5+
"strings"
6+
)
7+
8+
func ResolveSocketPath(socketPath, defaultPath, templateEnv, instance string) string {
9+
tpl := os.Getenv(templateEnv)
10+
if tpl != "" && strings.Contains(tpl, "%i") {
11+
if instance == "" {
12+
instance = "main"
13+
}
14+
if socketPath == "" || socketPath == defaultPath {
15+
return strings.ReplaceAll(tpl, "%i", instance)
16+
}
17+
}
18+
if socketPath == "" {
19+
return defaultPath
20+
}
21+
return socketPath
22+
}

0 commit comments

Comments
 (0)