diff --git a/gateway/server.go b/gateway/server.go index 69555941c3144fa8e0fd55a323261cb205d2d5cb..fe97862de5bb5eee0c27c3786fbd21fdd2c37e84 100644 --- a/gateway/server.go +++ b/gateway/server.go @@ -89,6 +89,7 @@ func main() { faasHandlers.UpdateFunction = handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer) faasHandlers.QueryFunction = handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer) faasHandlers.InfoHandler = handlers.MakeInfoHandler(handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer)) + faasHandlers.SecretHandler = handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer) alertHandler := plugin.NewExternalServiceQuery(*config.FunctionsProviderURL, credentials) faasHandlers.Alert = handlers.MakeAlertHandler(alertHandler) @@ -127,6 +128,8 @@ func main() { auth.DecorateWithBasicAuth(faasHandlers.InfoHandler, credentials) faasHandlers.AsyncReport = auth.DecorateWithBasicAuth(faasHandlers.AsyncReport, credentials) + faasHandlers.SecretHandler = + auth.DecorateWithBasicAuth(faasHandlers.SecretHandler, credentials) } r := mux.NewRouter() @@ -160,6 +163,8 @@ func main() { r.HandleFunc("/system/functions", faasHandlers.UpdateFunction).Methods(http.MethodPut) r.HandleFunc("/system/scale-function/{name:[-a-zA-Z_0-9]+}", faasHandlers.ScaleFunction).Methods(http.MethodPost) + r.HandleFunc("/system/secrets", faasHandlers.SecretHandler).Methods(http.MethodGet, http.MethodPut, http.MethodPost) + if faasHandlers.QueuedProxy != nil { r.HandleFunc("/async-function/{name:[-a-zA-Z_0-9]+}/", faasHandlers.QueuedProxy).Methods(http.MethodPost) r.HandleFunc("/async-function/{name:[-a-zA-Z_0-9]+}", faasHandlers.QueuedProxy).Methods(http.MethodPost) diff --git a/gateway/types/handler_set.go b/gateway/types/handler_set.go index 66bfe7155de595904399ab492b40fbcdb7b91675..aec478893cdedf9e805816e16864a189911de24d 100644 --- a/gateway/types/handler_set.go +++ b/gateway/types/handler_set.go @@ -26,4 +26,7 @@ type HandlerSet struct { // InfoHandler provides version and build info InfoHandler http.HandlerFunc + + // SecretHandler allows secrets to be managed + SecretHandler http.HandlerFunc }