summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-05-22 22:28:38 +0700
committerShulhan <m.shulhan@gmail.com>2020-07-26 03:48:51 +0700
commitda54844eeaa0b267d7b8c4a0732fe634ca424d45 (patch)
tree9e7c1aa695a0a8768bb57cec8416890f4f055473
parent03ab6a462ddbd7589ac385a219f035ca7975f856 (diff)
downloadrescached-da54844eeaa0b267d7b8c4a0732fe634ca424d45.tar.xz
all: make host and master directory static
Previously, user can change the location where the hosts files and master file using "rescached::dir.host" and "rescached::dir.master" options. This change disallow chaning both options and make them static.
-rw-r--r--_doc/rescached.cfg.adoc33
-rw-r--r--environment.go5
-rw-r--r--rescached.go4
3 files changed, 18 insertions, 24 deletions
diff --git a/_doc/rescached.cfg.adoc b/_doc/rescached.cfg.adoc
index 0408441..5f24a06 100644
--- a/_doc/rescached.cfg.adoc
+++ b/_doc/rescached.cfg.adoc
@@ -43,26 +43,6 @@ Format:: [host]:port
Default:: 127.0.0.1:5380
Description:: The address to listen for web user interface.
-[[dir.hosts]]
-==== +dir.hosts+
-
-Format:: string
-Default:: /etc/rescached/hosts.d
-Description:: Path to hosts directory.
-If set, rescached will load all hosts formatted files inside the directory.
-If its empty or unset, it will not loading hosts files even in default
-location.
-
-[[dir.master]]
-==== +dir.master+
-
-Format:: string
-Default:: /etc/rescached/master.d
-Description:: Path to master directory.
-If set, rescached will load all master files inside the directory.
-If its empty or unset, it will not loading master file even in default
-location.
-
[[file.resolvconf]]
==== +file.resolvconf+
@@ -218,6 +198,19 @@ Default:: -1h
Description:: The duration when the cache will be considered expired.
Its value must be negative and greater or equal than -1 hour (-3600 seconds).
+== FILES
+
+[[dir.hosts]]
+=== /etc/rescached/hosts.d
+
+Path to hosts directory where rescached will load all hosts formatted files.
+
+
+[[dir.master]]
+=== /etc/rescached/master.d
+
+Path to master directory where rescached will load all master files.
+
== EXAMPLE
diff --git a/environment.go b/environment.go
index 2cbe0e6..1dfe834 100644
--- a/environment.go
+++ b/environment.go
@@ -40,6 +40,9 @@ const (
keyTLSCertificate = "tls.certificate"
keyTLSPort = "tls.port"
keyTLSPrivateKey = "tls.private_key"
+
+ dirHosts = "/etc/rescached/hosts.d"
+ dirMaster = "/etc/rescached/master.d"
)
//
@@ -48,8 +51,6 @@ const (
type environment struct {
dns.ServerOptions
WuiListen string `ini:"rescached::wui.listen"`
- DirHosts string `ini:"rescached::dir.hosts"`
- DirMaster string `ini:"rescached::dir.master"`
FileResolvConf string `ini:"rescached::file.resolvconf"`
Debug int `ini:"rescached::debug"`
}
diff --git a/rescached.go b/rescached.go
index bf76b49..64db53a 100644
--- a/rescached.go
+++ b/rescached.go
@@ -60,8 +60,8 @@ func (srv *Server) Start() (err error) {
return err
}
- srv.dns.LoadHostsDir(srv.env.DirHosts)
- srv.dns.LoadMasterDir(srv.env.DirMaster)
+ srv.dns.LoadHostsDir(dirHosts)
+ srv.dns.LoadMasterDir(dirMaster)
srv.dns.LoadHostsFile("")
if len(srv.env.FileResolvConf) > 0 {