fix legacy SCUM RCON runtime profile resolution
This commit is contained in:
@@ -102,6 +102,23 @@ func runtimeLifecycleProfile(profiles domain.GamePluginRuntimeProfiles, key stri
|
||||
return profile, true
|
||||
}
|
||||
}
|
||||
// Older persisted bindings used "local" for the only local-process profile.
|
||||
// Infer that legacy key only when the plugin has one unambiguous candidate.
|
||||
if key != "local" {
|
||||
return domain.RuntimeLifecycleProfile{}, false
|
||||
}
|
||||
var candidate domain.RuntimeLifecycleProfile
|
||||
count := 0
|
||||
for _, profile := range profiles.LifecycleProfiles {
|
||||
if profile.Mode != "local-process" {
|
||||
continue
|
||||
}
|
||||
candidate = profile
|
||||
count++
|
||||
}
|
||||
if count == 1 {
|
||||
return candidate, true
|
||||
}
|
||||
return domain.RuntimeLifecycleProfile{}, false
|
||||
}
|
||||
|
||||
@@ -152,10 +169,11 @@ func runtimeBindingKeys(profiles domain.GamePluginRuntimeProfiles, profile domai
|
||||
}
|
||||
|
||||
func normalizeRuntimeBinding(plugin domain.GamePlugin, binding domain.RuntimeBinding) (domain.RuntimeBinding, error) {
|
||||
profile, _ := runtimeLifecycleProfile(plugin.RuntimeProfiles, binding.ProfileKey)
|
||||
if profile.Key == "" {
|
||||
profile, ok := runtimeLifecycleProfile(plugin.RuntimeProfiles, binding.ProfileKey)
|
||||
if !ok {
|
||||
return domain.RuntimeBinding{}, validationError("runtime profile is no longer declared")
|
||||
}
|
||||
binding.ProfileKey = profile.Key
|
||||
required, allowed := runtimeBindingKeys(plugin.RuntimeProfiles, profile)
|
||||
for key := range binding.Bindings {
|
||||
if _, ok := allowed[key]; !ok {
|
||||
|
||||
Reference in New Issue
Block a user