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

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2018-03-29 17:43:39 +0300
committerNick Thomas <nick@gitlab.com>2018-03-29 17:43:39 +0300
commite7b9a2c510c47f53346f2402eecfec92849e613f (patch)
treebd78ed49680b09eae808ec381dd3202637fa7ca4 /domain_config.go
parente51175062c0fada8fadc37f6fc96531ff750221b (diff)
Put domain code in a separate package
Diffstat (limited to 'domain_config.go')
-rw-r--r--domain_config.go42
1 files changed, 0 insertions, 42 deletions
diff --git a/domain_config.go b/domain_config.go
deleted file mode 100644
index f5c3db79..00000000
--- a/domain_config.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package main
-
-import (
- "encoding/json"
- "os"
- "path/filepath"
- "strings"
-)
-
-type domainConfig struct {
- Domain string
- Certificate string
- Key string
- HTTPSOnly bool `json:"https_only"`
-}
-
-type domainsConfig struct {
- Domains []domainConfig
- HTTPSOnly bool `json:"https_only"`
-}
-
-func (c *domainConfig) Valid(rootDomain string) bool {
- if c.Domain == "" {
- return false
- }
-
- // TODO: better sanitize domain
- domain := strings.ToLower(c.Domain)
- rootDomain = "." + rootDomain
- return !strings.HasSuffix(domain, rootDomain)
-}
-
-func (c *domainsConfig) Read(group, project string) (err error) {
- configFile, err := os.Open(filepath.Join(group, project, "config.json"))
- if err != nil {
- return err
- }
- defer configFile.Close()
-
- err = json.NewDecoder(configFile).Decode(c)
- return
-}