blob: 93717028e33979a6aeee4f3ed4c29f70eb0c7d34 (
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
32
33
34
35
36
37
|
package disk
import (
"net/http"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving/disk/local"
"gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab/client"
)
type customProjectResolver struct {
config *domainConfig
path string
}
func (p *customProjectResolver) Resolve(r *http.Request) (*serving.Request, error) {
if p.config == nil {
return nil, client.ErrDomainDoesNotExist
}
lookupPath := &serving.LookupPath{
ServingType: "file",
Prefix: "/",
Path: p.path,
IsNamespaceProject: false,
IsHTTPSOnly: p.config.HTTPSOnly,
HasAccessControl: p.config.AccessControl,
ProjectID: p.config.ID,
}
return &serving.Request{
Serving: local.Instance(),
LookupPath: lookupPath,
SubPath: r.URL.Path,
}, nil
}
|