one time CoreDNS file

This commit is contained in:
afeiszli 2021-09-28 13:16:41 -04:00
parent 12493680fb
commit 70afe33246
4 changed files with 16 additions and 3 deletions

View file

@ -48,6 +48,7 @@ type ServerConfig struct {
AgentBackend string `yaml:"agentbackend"`
ClientMode string `yaml:"clientmode"`
DNSMode string `yaml:"dnsmode"`
SplitDNS string `yaml:"splitdns"`
DisableRemoteIPCheck string `yaml:"disableremoteipcheck"`
DisableDefaultNet string `yaml:"disabledefaultnet"`
GRPCSSL string `yaml:"grpcssl"`

View file

@ -8,6 +8,7 @@ import (
"github.com/gravitl/netmaker/database"
"github.com/gravitl/netmaker/functions"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/servercfg"
"github.com/txn2/txeh"
)
@ -161,8 +162,9 @@ func SetDNS() error {
if err != nil {
return err
}
err = functions.SetCorefile(corefilestring)
if servercfg.IsSplitDNS() {
err = functions.SetCorefile(corefilestring)
}
return err
}

View file

@ -27,7 +27,7 @@ func SetDNSDir() error {
}
_, err = os.Stat(dir + "/config/dnsconfig/Corefile")
if os.IsNotExist(err) {
err = SetCorefile("example.com")
err = SetCorefile(".")
if err != nil {
PrintUserLog("",err.Error(),0)
}

View file

@ -345,3 +345,13 @@ func GetSQLConn() string {
}
return sqlconn
}
func IsSplitDNS() bool {
issplit := false
if os.Getenv("IS_SPLIT_DNS") == "yes" {
issplit = true
} else if config.Config.Server.SplitDNS == "yes" {
issplit = true
}
return issplit
}