Passing the publisher to the web provider
@@ -12,6 +12,7 @@ import (
"github.com/hellofresh/janus/pkg/middleware"
"github.com/hellofresh/janus/pkg/oauth"
"github.com/hellofresh/janus/pkg/router"
+ "github.com/hellofresh/janus/pkg/store"
)
// Provider is a provider.Provider implementation that provides the REST API.
@@ -23,6 +24,7 @@ type Provider struct {
Cred config.Credentials
APIRepo api.Repository
AuthRepo oauth.Repository
+ Publisher store.Publisher
}
// Provide executes the provider functionality
@@ -78,7 +80,7 @@ func (p *Provider) loadAPIEndpoints(router router.Router) {
log.Debug("Loading API Endpoints")
// Apis endpoints
- handler := api.NewController(p.APIRepo)
+ handler := api.NewController(p.APIRepo, p.Publisher)
group := router.Group("/apis")
{
group.GET("", handler.Get())
@@ -97,7 +99,7 @@ func (p *Provider) loadOAuthEndpoints(router router.Router) {
log.Debug("Loading OAuth Endpoints")
// Oauth servers endpoints
- oAuthHandler := oauth.NewController(p.AuthRepo)
+ oAuthHandler := oauth.NewController(p.AuthRepo, p.Publisher)
oauthGroup := router.Group("/oauth/servers")
{
oauthGroup.GET("", oAuthHandler.Get())
