Align runtime profiles with plugin-owned records
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user