Align runtime profiles with plugin-owned records

This commit is contained in:
npc0-hue
2026-09-02 10:22:14 +08:00
parent 6018d8f0fc
commit a027ca70eb
36 changed files with 234 additions and 1590 deletions
+25
View File
@@ -24,3 +24,28 @@ func applyPluginCreateDefaults(plugin domain.GamePlugin, definition domain.Serve
func deploymentNeedsCompleteRuntimeBinding(_ domain.GamePlugin, definition domain.ServerDeploymentDefinition) bool {
return definition.Mode == ""
}
// lifecycleDefaultProfileKey selects a plugin-declared lifecycle profile when
// an older server record has no explicit deployment profile. Runtime bindings
// remain optional logical transport overrides; they must not be required for
// standard Run lifecycle, file, or log workflows.
func lifecycleDefaultProfileKey(_ domain.ServerInstance, plugin domain.GamePlugin, profileKey string) string {
if profileKey != "" {
if profile, ok := runtimeLifecycleProfileForKey(plugin.RuntimeProfiles, profileKey); ok {
return profile.Key
}
return profileKey
}
return firstRuntimeLifecycleProfileKey(plugin)
}
func defaultRunDistributionProfileKey(plugin domain.GamePlugin, profileKey string) string {
return lifecycleDefaultProfileKey(domain.ServerInstance{}, plugin, profileKey)
}
func firstRuntimeLifecycleProfileKey(plugin domain.GamePlugin) string {
if len(plugin.RuntimeProfiles.LifecycleProfiles) == 0 {
return ""
}
return plugin.RuntimeProfiles.LifecycleProfiles[0].Key
}