aboutsummaryrefslogtreecommitdiff
path: root/core/dns/storage.go
blob: 0c8e6843746949aed65c65f8cdf7ca8173cf4c07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
}