Hand checked processing selections to execution
This commit is contained in:
@@ -91,12 +91,21 @@ func SharedVariables() map[string]string {
|
||||
|
||||
// WithSharedVariables fills missing Audita instruction variables without replacing caller values.
|
||||
func WithSharedVariables(values map[string]string) map[string]string {
|
||||
result := make(map[string]string, len(values)+3)
|
||||
return mergeSharedVariables(values, false)
|
||||
}
|
||||
|
||||
// ProcessingVariables uses the pipeline's instructions for shared variables.
|
||||
func ProcessingVariables(values map[string]string) map[string]string {
|
||||
return mergeSharedVariables(values, true)
|
||||
}
|
||||
|
||||
func mergeSharedVariables(values map[string]string, authoritative bool) map[string]string {
|
||||
result := make(map[string]string, len(values)+4)
|
||||
for key, value := range values {
|
||||
result[key] = value
|
||||
}
|
||||
for key, value := range SharedVariables() {
|
||||
if _, exists := result[key]; !exists {
|
||||
if _, exists := result[key]; authoritative || !exists {
|
||||
result[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user