-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple ee build tags for streaming middleware
- Loading branch information
Tit Petric
committed
Oct 25, 2024
1 parent
29bc56a
commit 587d634
Showing
19 changed files
with
123 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// This package takes care of registering the EE componts to Gateway. | ||
package register |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build ee || dev | ||
|
||
package register | ||
|
||
import ( | ||
"github.com/TykTechnologies/tyk/ee/middleware/streams" | ||
|
||
"github.com/TykTechnologies/tyk/internal/middleware" | ||
"github.com/TykTechnologies/tyk/internal/model" | ||
) | ||
|
||
func init() { | ||
middleware.Add("ee:middleware:streaming", func(gw model.Gateway, base model.LoggerProvider, spec model.MergedAPI) model.Middleware { | ||
return streams.NewMiddleware(gw, base.Logger(), spec) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package middleware | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/TykTechnologies/tyk/internal/model" | ||
) | ||
|
||
type ProviderFn func(model.Gateway, model.LoggerProvider, model.MergedAPI) model.Middleware | ||
|
||
var globals = struct { | ||
mu *sync.RWMutex | ||
registry map[string][]ProviderFn | ||
}{ | ||
mu: &sync.RWMutex{}, | ||
registry: map[string][]ProviderFn{}, | ||
} | ||
|
||
func Add(hook string, provider ProviderFn) { | ||
globals.mu.Lock() | ||
defer globals.mu.Unlock() | ||
|
||
globals.registry[hook] = append(globals.registry[hook], provider) | ||
} | ||
|
||
func Get(hook string) []ProviderFn { | ||
globals.mu.RLock() | ||
defer globals.mu.RUnlock() | ||
|
||
data, _ := globals.registry[hook] | ||
return data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package httputil | ||
package repository | ||
|
||
import ( | ||
"context" | ||
|
Oops, something went wrong.