diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-09-24 16:05:27 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-09-25 15:54:42 +0300 |
commit | 950c1cbf8b4de8af7d1933ab9ff25b946ffe3ddc (patch) | |
tree | 1056c12f48204a334a99ef6b46aa2d2242a246ed /internal/serving/serving.go | |
parent | e5d6997a68f323bc345928d14ac902ac506b4a67 (diff) |
Extract disk serving from domain package
Diffstat (limited to 'internal/serving/serving.go')
-rw-r--r-- | internal/serving/serving.go | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/internal/serving/serving.go b/internal/serving/serving.go index bc0bb61d..0007d582 100644 --- a/internal/serving/serving.go +++ b/internal/serving/serving.go @@ -1,9 +1,31 @@ package serving -import "net/http" +import ( + "net/http" + + "gitlab.com/gitlab-org/gitlab-pages/internal/serving/disk" +) -// Serving represents an interface used to serve pages for a given domain / -// address type Serving interface { - ServeHTTP(http.ResponseWriter, *http.Request) + ServeFileHTTP(http.ResponseWriter, *http.Request) bool + ServeNotFoundHTTP(http.ResponseWriter, *http.Request) + HasAcmeChallenge(token string) bool +} + +func NewProjectDiskServing(project, group string) Serving { + return &disk.Project{ + Location: project, + Reader: &disk.Reader{ + Group: group, + }, + } +} + +func NewGroupDiskServing(group string, resolver disk.Resolver) Serving { + return &disk.Group{ + Resolver: resolver, + Reader: &disk.Reader{ + Group: group, + }, + } } |