mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-11 15:44:52 +08:00
one time CoreDNS file
This commit is contained in:
parent
12493680fb
commit
70afe33246
4 changed files with 16 additions and 3 deletions
|
@ -48,6 +48,7 @@ type ServerConfig struct {
|
||||||
AgentBackend string `yaml:"agentbackend"`
|
AgentBackend string `yaml:"agentbackend"`
|
||||||
ClientMode string `yaml:"clientmode"`
|
ClientMode string `yaml:"clientmode"`
|
||||||
DNSMode string `yaml:"dnsmode"`
|
DNSMode string `yaml:"dnsmode"`
|
||||||
|
SplitDNS string `yaml:"splitdns"`
|
||||||
DisableRemoteIPCheck string `yaml:"disableremoteipcheck"`
|
DisableRemoteIPCheck string `yaml:"disableremoteipcheck"`
|
||||||
DisableDefaultNet string `yaml:"disabledefaultnet"`
|
DisableDefaultNet string `yaml:"disabledefaultnet"`
|
||||||
GRPCSSL string `yaml:"grpcssl"`
|
GRPCSSL string `yaml:"grpcssl"`
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/gravitl/netmaker/database"
|
"github.com/gravitl/netmaker/database"
|
||||||
"github.com/gravitl/netmaker/functions"
|
"github.com/gravitl/netmaker/functions"
|
||||||
"github.com/gravitl/netmaker/models"
|
"github.com/gravitl/netmaker/models"
|
||||||
|
"github.com/gravitl/netmaker/servercfg"
|
||||||
"github.com/txn2/txeh"
|
"github.com/txn2/txeh"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -161,8 +162,9 @@ func SetDNS() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = functions.SetCorefile(corefilestring)
|
if servercfg.IsSplitDNS() {
|
||||||
|
err = functions.SetCorefile(corefilestring)
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ func SetDNSDir() error {
|
||||||
}
|
}
|
||||||
_, err = os.Stat(dir + "/config/dnsconfig/Corefile")
|
_, err = os.Stat(dir + "/config/dnsconfig/Corefile")
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
err = SetCorefile("example.com")
|
err = SetCorefile(".")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
PrintUserLog("",err.Error(),0)
|
PrintUserLog("",err.Error(),0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,3 +345,13 @@ func GetSQLConn() string {
|
||||||
}
|
}
|
||||||
return sqlconn
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue