Welcome to mirror list, hosted at ThFree Co, Russian Federation.

custom.go « disk « source « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8a080f208b95b84a0e86fe799ae93dde64f3ab7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package disk

import (
	"net/http"

	"gitlab.com/gitlab-org/gitlab-pages/internal/serving"
)

type customProjectResolver struct {
	config *domainConfig

	path string
}

// TODO tests
func (p *customProjectResolver) Resolve(r *http.Request) (*serving.LookupPath, string, error) {
	lookupPath := &serving.LookupPath{
		Location:           "/",
		Path:               p.path,
		IsNamespaceProject: false,
		IsHTTPSOnly:        p.config.HTTPSOnly,
		HasAccessControl:   p.config.AccessControl,
		ProjectID:          p.config.ID,
	}

	return lookupPath, r.URL.Path, nil
}