github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/plugin/configmutator_plugin.go (about)

     1  // Copyright (c) 2018-2021, R.I. Pienaar and the Choria Project contributors
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package plugin
     6  
     7  import (
     8  	"fmt"
     9  
    10  	"github.com/choria-io/go-choria/config"
    11  )
    12  
    13  func registerConfigMutator(name string, plugin Pluggable) error {
    14  	mutator, ok := plugin.PluginInstance().(config.Mutator)
    15  	if !ok {
    16  		return fmt.Errorf("%s is not a valid configuration mutator plugin", plugin.PluginName())
    17  	}
    18  
    19  	config.RegisterMutator(plugin.PluginName(), mutator)
    20  
    21  	return nil
    22  }