diff --git a/api/cmd/portainer/main.go b/api/cmd/portainer/main.go index 8b34fc070..ada5b77e6 100644 --- a/api/cmd/portainer/main.go +++ b/api/cmd/portainer/main.go @@ -674,6 +674,7 @@ func main() { ResourceControlService: store.ResourceControlService, SettingsService: store.SettingsService, RegistryService: store.RegistryService, + DeploymentKeyService: store.DeploymentKeyService, DockerHubService: store.DockerHubService, StackService: store.StackService, ScheduleService: store.ScheduleService, diff --git a/api/http/handler/deploymentkeys/deploymentkey_create.go b/api/http/handler/deploymentkeys/deploymentkey_create.go index 2ec7838ce..a25881723 100644 --- a/api/http/handler/deploymentkeys/deploymentkey_create.go +++ b/api/http/handler/deploymentkeys/deploymentkey_create.go @@ -33,7 +33,7 @@ func (handler *Handler) deploymentkeyCreate(w http.ResponseWriter, r *http.Reque return &httperror.HandlerError{http.StatusNotFound, "Unable to find a deployment key with the specified identifier inside the database", err} } else if err != nil { return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find a deployment key with the specified identifier inside the database", err} - } + } // Add a function to call and create public key and private key diff --git a/api/http/handler/deploymentkeys/handler.go b/api/http/handler/deploymentkeys/handler.go index 9fd9b709f..81119bd12 100644 --- a/api/http/handler/deploymentkeys/handler.go +++ b/api/http/handler/deploymentkeys/handler.go @@ -9,7 +9,7 @@ import ( "github.com/portainer/portainer/api/http/security" ) -// Handler is the HTTP handler used to handle webhook operations. +// Handler is the HTTP handler used to handle deploymentkey operations. type Handler struct { *mux.Router DeploymentKeyService portainer.DeploymentKeyService diff --git a/api/http/server.go b/api/http/server.go index b232adcdc..d735a184f 100644 --- a/api/http/server.go +++ b/api/http/server.go @@ -9,6 +9,7 @@ import ( "github.com/portainer/portainer/api/docker" "github.com/portainer/portainer/api/http/handler" "github.com/portainer/portainer/api/http/handler/auth" + "github.com/portainer/portainer/api/http/handler/deploymentkeys" "github.com/portainer/portainer/api/http/handler/dockerhub" "github.com/portainer/portainer/api/http/handler/endpointgroups" "github.com/portainer/portainer/api/http/handler/endpointproxy" @@ -51,6 +52,7 @@ type Server struct { JobScheduler portainer.JobScheduler Snapshotter portainer.Snapshotter RoleService portainer.RoleService + DeploymentKeyService portainer.DeploymentKeyService DockerHubService portainer.DockerHubService EndpointService portainer.EndpointService EndpointGroupService portainer.EndpointGroupService @@ -222,9 +224,13 @@ func (server *Server) Start() error { webhookHandler.EndpointService = server.EndpointService webhookHandler.DockerClientFactory = server.DockerClientFactory + var deploymentKeyHandler = deploymentkeys.NewHandler(requestBouncer) + deploymentKeyHandler.DeploymentKeyService = server.DeploymentKeyService + server.Handler = &handler.Handler{ RoleHandler: roleHandler, AuthHandler: authHandler, + DeploymentKeyHandler: deploymentKeyHandler, DockerHubHandler: dockerHubHandler, EndpointGroupHandler: endpointGroupHandler, EndpointHandler: endpointHandler,