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: 4d991437520c41b5ad92f7f499d1ce83a23d8674 (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
28
29
30
31
package disk

import (
	"net/http"

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

type customProjectResolver struct {
	config *domainConfig

	path string
}

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

	return &serving.Request{
		Serving:    disk.Instance(),
		LookupPath: lookupPath,
		SubPath:    r.URL.Path,
	}, nil
}