diff options
| author | Shulhan <ms@kilabit.info> | 2022-04-19 23:18:19 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-04-19 23:30:09 +0700 |
| commit | ed83581fc716d5d41d769662fae0bc5e78309982 (patch) | |
| tree | 8f11ad99ee9ef2dfd595c485d01425fd1affb574 /httpd.go | |
| parent | 2ada0a2da129a33229d63462b2c7fa7ccd5d0460 (diff) | |
| download | rescached-ed83581fc716d5d41d769662fae0bc5e78309982.tar.xz | |
all: add option to set the base directory
Previously, running an instance of rescached assume that all
configurations and cache are located in /etc/rescached and
/var/cache/rescached.
It possible that we may want to use different base directory (or $PREFIX,
in the auto tools terms), for example "/opt/rescached" or as showed
in the "dev" task in the Makefile, we use "_test" as base directory
for running test instance.
This changes also fix an error when loading hosts file from non-existant
hosts.d directory.
Diffstat (limited to 'httpd.go')
| -rw-r--r-- | httpd.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -512,7 +512,7 @@ func (srv *Server) apiHostsFileCreate(epr *libhttp.EndpointRequest) (resbody []b _, found = srv.env.HostsFiles[name] if !found { - path = filepath.Join(dirHosts, name) + path = filepath.Join(srv.env.pathDirHosts, name) hfile, err = dns.NewHostsFile(path, nil) if err != nil { res.Code = http.StatusInternalServerError @@ -733,7 +733,7 @@ func (srv *Server) apiZoneCreate(epr *libhttp.EndpointRequest) (resbody []byte, return json.Marshal(&res) } - zoneFile = filepath.Join(dirZone, zoneName) + zoneFile = filepath.Join(srv.env.pathDirZone, zoneName) zone = dns.NewZone(zoneFile, zoneName) err = zone.Save() if err != nil { |
