diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-11 16:21:28 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-11 16:21:28 +0300 |
commit | 8d0cdba657ec249a1815a8f83c8cda0031dbf190 (patch) | |
tree | 53cd3eab5038535769c379ef92f34200441c81e0 /domain_config.go | |
parent | 259af85e875293e9cd6061cf1058ea0cc2e83dcc (diff) |
Read configuration and updates from shares/pages/group/project/config.json and shares/pages/.update
Diffstat (limited to 'domain_config.go')
-rw-r--r-- | domain_config.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/domain_config.go b/domain_config.go new file mode 100644 index 00000000..d16ca9ad --- /dev/null +++ b/domain_config.go @@ -0,0 +1,28 @@ +package main + +import ( + "encoding/json" + "os" + "path/filepath" +) + +type domainConfig struct { + Domain string + Certificate string + Key string +} + +type domainsConfig struct { + Domains []domainConfig +} + +func (c *domainsConfig) Read(group, project string) (err error) { + configFile, err := os.Open(filepath.Join(*pagesRoot, project, group, "config.json")) + if err != nil { + return nil + } + defer configFile.Close() + + err = json.NewDecoder(configFile).Decode(c) + return +} |