Browse Source

moved db call and removed grpc stuff

worker-9 4 years ago
parent
commit
9635590322
3 changed files with 7 additions and 19 deletions
  1. 1 1
      config/dnsconfig/Corefile
  2. 0 5
      config/dnsconfig/netmaker.hosts
  3. 6 13
      main.go

+ 1 - 1
config/dnsconfig/Corefile

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

+ 0 - 5
config/dnsconfig/netmaker.hosts

@@ -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

+ 6 - 13
main.go

@@ -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