51 lines
1.1 KiB
Go
Executable File
51 lines
1.1 KiB
Go
Executable File
package provision
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
|
|
"zlh-agent/internal/provcommon"
|
|
"zlh-agent/internal/state"
|
|
)
|
|
|
|
const (
|
|
ServersRoot = provcommon.ServersRoot
|
|
JavaRoot = provcommon.JavaRoot
|
|
SteamCMDPath = provcommon.SteamCMDPath
|
|
)
|
|
|
|
func ServerDir(cfg state.Config) string {
|
|
return provcommon.ServerDir(cfg)
|
|
}
|
|
|
|
func JavaDir(cfg state.Config) string {
|
|
return provcommon.JavaDir(cfg)
|
|
}
|
|
|
|
func BuildArtifactURL(path string) string {
|
|
return provcommon.BuildArtifactURL(path)
|
|
}
|
|
|
|
// Local fallback used ONLY inside this package — NOT exported.
|
|
func buildArtifactURL(path string) string {
|
|
if strings.HasPrefix(path, "http://") || strings.HasPrefix(path, "https://") {
|
|
return path
|
|
}
|
|
|
|
base := os.Getenv("ZLH_ARTIFACT_BASE_URL")
|
|
if base == "" {
|
|
base = "http://10.60.0.251:8080/" // fallback
|
|
}
|
|
|
|
return strings.TrimRight(base, "/") + "/" + strings.TrimLeft(path, "/")
|
|
}
|
|
|
|
func IsSteamGame(game string) bool {
|
|
g := strings.ToLower(game)
|
|
switch g {
|
|
case "valheim", "rust", "terraria", "projectzomboid":
|
|
return true
|
|
}
|
|
return false
|
|
}
|