Exemple #1
0
func (v *BlackholeConfig) Build() (*serial.TypedMessage, error) {
	config := new(blackhole.Config)
	if v.Response != nil {
		response, _, err := configLoader.Load(v.Response)
		if err != nil {
			return nil, errors.Base(err).Message("Blackhole: Failed to parse response config.")
		}
		responseSettings, err := response.(Buildable).Build()
		if err != nil {
			return nil, err
		}
		config.Response = responseSettings
	}

	return serial.ToTypedMessage(config), nil
}
Exemple #2
0
func (this *BlackholeConfig) Build() (*loader.TypedSettings, error) {
	config := new(blackhole.Config)
	if this.Response != nil {
		response, _, err := configLoader.Load(this.Response)
		if err != nil {
			return nil, errors.New("Blackhole: Failed to parse response config: " + err.Error())
		}
		responseSettings, err := response.(Buildable).Build()
		if err != nil {
			return nil, err
		}
		config.Response = responseSettings
	}

	return loader.NewTypedSettings(config), nil
}