2021-06-19 08:45:43 -04:00
|
|
|
package v4
|
2021-02-08 05:18:52 -05:00
|
|
|
|
|
|
|
type ConfigureFilePostProcessingStage interface {
|
|
|
|
Process(conf *Config) error
|
|
|
|
}
|
|
|
|
|
|
|
|
var configureFilePostProcessingStages map[string]ConfigureFilePostProcessingStage
|
|
|
|
|
|
|
|
func RegisterConfigureFilePostProcessingStage(name string, stage ConfigureFilePostProcessingStage) {
|
|
|
|
if configureFilePostProcessingStages == nil {
|
|
|
|
configureFilePostProcessingStages = make(map[string]ConfigureFilePostProcessingStage)
|
|
|
|
}
|
|
|
|
configureFilePostProcessingStages[name] = stage
|
|
|
|
}
|
|
|
|
|
|
|
|
func PostProcessConfigureFile(conf *Config) error {
|
|
|
|
for k, v := range configureFilePostProcessingStages {
|
|
|
|
if err := v.Process(conf); err != nil {
|
|
|
|
return newError("Rejected by Postprocessing Stage ", k).AtError().Base(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|