blob: fb2aafcdcc63d34ea4018fbe1b1599eff4ef9a76 (
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
|
package disk
import (
"net/http"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving/disk/local"
)
type customProjectResolver struct {
config *domainConfig
path string
}
func (p *customProjectResolver) Resolve(r *http.Request) (*serving.Request, error) {
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
}
|