diff --git a/cmd/appender/main.go b/cmd/appender/main.go index b90bdbfff7..c693985719 100644 --- a/cmd/appender/main.go +++ b/cmd/appender/main.go @@ -41,7 +41,8 @@ https://knative.dev/docs/eventing/sequence/ */ type envConfig struct { - Msg string `envconfig:"MESSAGE" default:"boring default msg, change me with env[MESSAGE]"` + Msg string `envconfig:"MESSAGE" default:"boring default msg, change me with env[MESSAGE]"` + Type string `envconfig:"TYPE"` } var ( @@ -73,6 +74,11 @@ func gotEvent(event cloudevents.Event, resp *cloudevents.EventResponse) error { Data: data, } + // Resolve type + if env.Type != "" { + r.Context.SetType(env.Type) + } + r.SetDataContentType(cloudevents.ApplicationJSON) log.Println("Transform the event to: ")