Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth syntax and pass only in the filters not the entire config #2115

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ func runSubscribe(cmd *cobra.Command, args []string) (err error) {
// add subscription to function
f.Deploy.Subscriptions = append(f.Deploy.Subscriptions, fn.KnativeSubscription{
Source: cfg.Source,
Filters: extractFilterMap(cfg),
Filters: extractFilterMap(cfg.Filter),
})

// pump it
return f.Write()

}

func extractFilterMap(cfg subscibeConfig) map[string]string {
func extractFilterMap(filters []string) map[string]string {
subscriptionFilters := make(map[string]string)
for _, filter := range cfg.Filter {
for _, filter := range filters {
kv := strings.Split(filter, "=")
if len(kv) != 2 {
fmt.Println("Invalid pair:", filter)
Expand Down
Loading