]> Sergey Matveev's repositories - godlighty.git/blob - rc/example.cfg/static.go
fc56013fb9497e6aa6f3c2d8da33b7b68f9cd889
[godlighty.git] / rc / example.cfg / static.go
1 // Various static directories
2
3 package cfg
4
5 import (
6         "path"
7
8         "go.stargrave.org/godlighty"
9 )
10
11 func addStaticCfg(host, root string) {
12         if !path.IsAbs(root) {
13                 root = path.Join(WWW, root)
14         }
15         godlighty.Hosts[host] = &godlighty.HostCfg{
16                 Root: root,
17                 TLS:  newTLSCfg(host),
18         }
19 }
20
21 func addStaticListedDir(host, root string) {
22         addStaticCfg(host, root)
23         godlighty.Hosts[host].DirList = true
24         godlighty.Hosts[host].WebDAV = true
25 }
26
27 func addStaticWebDAVedDir(host, root string) {
28         addStaticCfg(host, root)
29         godlighty.Hosts[host].WebDAV = true
30 }
31
32 func init() {
33         addStaticCfg("www.stargrave.org", "stargrave.org")
34
35         addStaticListedDir("www.mds.cypherpunks.ru", "/storage/audiobook/mds")
36
37         addStaticWebDAVedDir("cpan.mirror.cypherpunks.ru", "/storage/cpan/cpan")
38         addStaticWebDAVedDir("ctan.mirror.cypherpunks.ru", "/storage/ctan/ctan")
39 }