1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 21:39:40 +02:00
portainer/api/http/handler/registries/proxy_gitlab.go
xAt0mZ 198e92c734 feat(registry): gitlab support (#3107)
* feat(api): gitlab registry type

* feat(registries): early support for gitlab registries

* feat(app): registry service selector

* feat(registry): gitlab support : list repositories and tags - remove features missing

* feat(registry): gitlab registry remove features

* feat(registry): gitlab switch to registry V2 API for repositories and tags

* feat(api): use development extension binary

* fix(registry): avoid 401 on gitlab retrieve to disconnect the user

* feat(registry): gitlab browse projects without extension

* style(app): code cleaning

* refactor(app): PR review changes + refactor on types

* fix(gitlab): remove gitlab info from registrymanagementconfig and force gitlab type

* style(api): go fmt

* feat(api): update APIVersion and ExtensionDefinitionsURL

* fix(api): fix invalid RM extension URL

* feat(registry): PAT scope help

* feat(registry): defaults on registry creation

* style(registry-creation): update layout and text for Gitlab registry

* feat(registry-creation): update gitlab notice
2019-11-12 16:28:31 +13:00

23 lines
695 B
Go

package registries
import (
"net/http"
httperror "github.com/portainer/libhttp/error"
)
// request on /api/registries/proxies/gitlab
func (handler *Handler) proxyRequestsToGitlabAPIWithoutRegistry(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
domain := r.Header.Get("X-Gitlab-Domain")
if domain == "" {
return &httperror.HandlerError{http.StatusBadRequest, "No Gitlab domain provided", nil}
}
proxy, err := handler.ProxyManager.CreateGitlabProxy(domain)
if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to create gitlab proxy", err}
}
http.StripPrefix("/registries/proxies/gitlab", proxy).ServeHTTP(w, r)
return nil
}