コード例 #1
0
ファイル: storage.go プロジェクト: yuewko/coredns
package dns

import (
	"path/filepath"

	"github.com/miekg/coredns/core/assets"
)

var storage = Storage(assets.Path())

// Storage is a root directory and facilitates
// forming file paths derived from it.
type Storage string

// Zones gets the directory that stores zones data.
func (s Storage) Zones() string {
	return filepath.Join(string(s), "zones")
}

// Zone returns the path to the folder containing assets for domain.
func (s Storage) Zone(domain string) string {
	return filepath.Join(s.Zones(), domain)
}

// SecondaryZoneFile returns the path to domain's secondary zone file (when fetched).
func (s Storage) SecondaryZoneFile(domain string) string {
	return filepath.Join(s.Zone(domain), "db."+domain)
}
コード例 #2
0
ファイル: storage.go プロジェクト: yuewko/coredns
package https

import (
	"path/filepath"
	"strings"

	"github.com/miekg/coredns/core/assets"
)

// storage is used to get file paths in a consistent,
// cross-platform way for persisting Let's Encrypt assets
// on the file system.
var storage = Storage(filepath.Join(assets.Path(), "letsencrypt"))

// Storage is a root directory and facilitates
// forming file paths derived from it.
type Storage string

// Sites gets the directory that stores site certificate and keys.
func (s Storage) Sites() string {
	return filepath.Join(string(s), "sites")
}

// Site returns the path to the folder containing assets for domain.
func (s Storage) Site(domain string) string {
	return filepath.Join(s.Sites(), domain)
}

// SiteCertFile returns the path to the certificate file for domain.
func (s Storage) SiteCertFile(domain string) string {
	return filepath.Join(s.Site(domain), domain+".crt")