moved db call and removed grpc stuff

This commit is contained in:
worker-9 2021-07-28 16:40:13 -04:00
parent fb5f08be5a
commit 9635590322
3 changed files with 7 additions and 19 deletions

View file

@ -1,4 +1,4 @@
pissant comms {
example.com {
reload 15s
hosts /root/dnsconfig/netmaker.hosts {
fallthrough

View file

@ -1,5 +0,0 @@
11.22.44.1 netmaker.pissant
11.22.44.3 node-mtxy5.pissant
11.22.44.5 node-vnqlu.pissant
11.22.44.4 ubuntu-do.pissant ubuntu.pissant
11.22.44.2 alex-laptop.pissant porngood.pissant

19
main.go
View file

@ -17,7 +17,6 @@ import (
"github.com/gravitl/netmaker/functions"
nodepb "github.com/gravitl/netmaker/grpc"
"github.com/gravitl/netmaker/servercfg"
"github.com/gravitl/netmaker/serverctl"
"google.golang.org/grpc"
)
@ -28,8 +27,13 @@ func main() {
startControllers() // start the grpc or rest endpoints
}
func checkModes() { // Client Mode Prereq Check
func initialize() { // Client Mode Prereq Check
var err error
if err = database.InitializeDatabase(); err != nil {
log.Println("Error connecting to database.")
log.Fatal(err)
}
log.Println("database successfully connected.")
cmd := exec.Command("id", "-u")
output, err := cmd.Output()
@ -45,7 +49,6 @@ func checkModes() { // Client Mode Prereq Check
if uid != 0 {
log.Fatal("To run in client mode requires root privileges. Either disable client mode or run with sudo.")
}
database.InitializeDatabase()
if servercfg.IsDNSMode() {
err := functions.SetDNSDir()
@ -56,16 +59,6 @@ func checkModes() { // Client Mode Prereq Check
}
func initialize() {
checkModes() // check which flags are set and if root or not
if servercfg.IsGRPCWireGuard() {
if err := serverctl.InitServerWireGuard(); err != nil {
log.Fatal(err)
}
}
functions.PrintUserLog("netmaker", "successfully created db tables if not present", 1)
}
func startControllers() {
var waitnetwork sync.WaitGroup
//Run Agent Server