Browse Source

Merge pull request #2053 from yearski/hotfix_0.17.1_remove-orphans

remove orphaned code
dcarns 2 years ago
parent
commit
e771d91397

+ 0 - 3
config/config.go

@@ -42,7 +42,6 @@ type ServerConfig struct {
 	AllowedOrigin         string `yaml:"allowedorigin"`
 	NodeID                string `yaml:"nodeid"`
 	RestBackend           string `yaml:"restbackend"`
-	AgentBackend          string `yaml:"agentbackend"`
 	MessageQueueBackend   string `yaml:"messagequeuebackend"`
 	DNSMode               string `yaml:"dnsmode"`
 	DisableRemoteIPCheck  string `yaml:"disableremoteipcheck"`
@@ -50,9 +49,7 @@ type ServerConfig struct {
 	SQLConn               string `yaml:"sqlconn"`
 	Platform              string `yaml:"platform"`
 	Database              string `yaml:"database"`
-	DefaultNodeLimit      int32  `yaml:"defaultnodelimit"`
 	Verbosity             int32  `yaml:"verbosity"`
-	ServerCheckinInterval int64  `yaml:"servercheckininterval"`
 	AuthProvider          string `yaml:"authprovider"`
 	OIDCIssuer            string `yaml:"oidcissuer"`
 	ClientID              string `yaml:"clientid"`

+ 0 - 1
config/environments/dev.yaml

@@ -4,7 +4,6 @@ server:
   masterkey: "" # defaults to 'secretkey' or MASTER_KEY (if set)
   allowedorigin: "" # defaults to '*' or CORS_ALLOWED_ORIGIN (if set)
   restbackend: "" # defaults to "on" or REST_BACKEND (if set)
-  agentbackend: "" # defaults to "on" or AGENT_BACKEND (if set)
   dnsmode: "" # defaults to "on" or DNS_MODE (if set)
   sqlconn: "" # defaults to "http://" or SQL_CONN (if set)
   disableremoteipcheck: "" # defaults to "false" or DISABLE_REMOTE_IP_CHECK (if set)

+ 1 - 2
controllers/config/environments/dev.yaml

@@ -4,7 +4,6 @@ server:
   masterkey: ""
   allowedorigin: "*"
   restbackend: true            
-  agentbackend: true
   defaultnetname: "default"
   defaultnetrange: "10.10.10.0/24"
-  createdefault: true
+  createdefault: true

+ 0 - 7
dev.yaml

@@ -3,17 +3,12 @@ server:
   apiconn: "api.ping.clustercat.com:443"
   apihost: ""
   apiport: "8081"
-  grpcconn: "grpc.ping.clustercat.com:443"
-  grpchost: ""
-  grpcport: "50051"
-  grpcsecure: "on"
   mqhost: "localhost"
   masterkey: "secretkey"
   dnskey: ""
   allowedorigin: "*"
   nodeid: "netmaker"
   restbackend: "on"
-  agentbackend: "on"
   messagequeuebackend: "on"
   dnsmode: "on"
   disableremoteipcheck: ""
@@ -22,9 +17,7 @@ server:
   sqlconn: ""
   platform: ""
   database: "sqlite"
-  defaultnodelimit: ""
   verbosity: 3
-  servercheckininterval: ""
   authprovider: ""
   clientid: ""
   clientsecret: ""

+ 2 - 2
main.go

@@ -136,8 +136,8 @@ func startControllers() {
 		go runMessageQueue(&waitnetwork)
 	}
 
-	if !servercfg.IsAgentBackend() && !servercfg.IsRestBackend() && !servercfg.IsMessageQueueBackend() {
-		logger.Log(0, "No Server Mode selected, so nothing is being served! Set Agent mode (AGENT_BACKEND) or Rest mode (REST_BACKEND) or MessageQueue (MESSAGEQUEUE_BACKEND) to 'true'.")
+	if !servercfg.IsRestBackend() && !servercfg.IsMessageQueueBackend() {
+		logger.Log(0, "No Server Mode selected, so nothing is being served! Set Rest mode (REST_BACKEND) or MessageQueue (MESSAGEQUEUE_BACKEND) to 'true'.")
 	}
 
 	// starts the stun server

+ 0 - 53
servercfg/serverconf.go

@@ -46,10 +46,6 @@ func GetServerConfig() config.ServerConfig {
 	if IsRestBackend() {
 		cfg.RestBackend = "on"
 	}
-	cfg.AgentBackend = "off"
-	if IsAgentBackend() {
-		cfg.AgentBackend = "on"
-	}
 	cfg.DNSMode = "off"
 	if IsDNSMode() {
 		cfg.DNSMode = "on"
@@ -167,15 +163,6 @@ func GetAPIHost() string {
 	return serverhost
 }
 
-// GetPodIP - get the pod's ip
-func GetPodIP() string {
-	podip := "127.0.0.1"
-	if os.Getenv("POD_IP") != "" {
-		podip = os.Getenv("POD_IP")
-	}
-	return podip
-}
-
 // GetAPIPort - gets the api port
 func GetAPIPort() string {
 	apiport := "8081"
@@ -198,19 +185,6 @@ func GetStunAddr() string {
 	return stunAddr
 }
 
-// GetDefaultNodeLimit - get node limit if one is set
-func GetDefaultNodeLimit() int32 {
-	var limit int32
-	limit = 999999999
-	envlimit, err := strconv.Atoi(os.Getenv("DEFAULT_NODE_LIMIT"))
-	if err == nil && envlimit != 0 {
-		limit = int32(envlimit)
-	} else if config.Config.Server.DefaultNodeLimit != 0 {
-		limit = config.Config.Server.DefaultNodeLimit
-	}
-	return limit
-}
-
 // GetCoreDNSAddr - gets the core dns address
 func GetCoreDNSAddr() string {
 	addr, _ := GetPublicIP()
@@ -313,21 +287,6 @@ func IsMetricsExporter() bool {
 	return export
 }
 
-// IsAgentBackend - checks if agent backed is on or off
-func IsAgentBackend() bool {
-	isagent := true
-	if os.Getenv("AGENT_BACKEND") != "" {
-		if os.Getenv("AGENT_BACKEND") == "off" {
-			isagent = false
-		}
-	} else if config.Config.Server.AgentBackend != "" {
-		if config.Config.Server.AgentBackend == "off" {
-			isagent = false
-		}
-	}
-	return isagent
-}
-
 // IsMessageQueueBackend - checks if message queue is on or off
 func IsMessageQueueBackend() bool {
 	ismessagequeue := true
@@ -525,18 +484,6 @@ func SetNodeID(id string) {
 	config.Config.Server.NodeID = id
 }
 
-// GetServerCheckinInterval - gets the server check-in time
-func GetServerCheckinInterval() int64 {
-	var t = int64(5)
-	var envt, _ = strconv.Atoi(os.Getenv("SERVER_CHECKIN_INTERVAL"))
-	if envt > 0 {
-		t = int64(envt)
-	} else if config.Config.Server.ServerCheckinInterval > 0 {
-		t = config.Config.Server.ServerCheckinInterval
-	}
-	return t
-}
-
 // GetAuthProviderInfo = gets the oauth provider info
 func GetAuthProviderInfo() (pi []string) {
 	var authProvider = ""

+ 0 - 8
swagger.yaml

@@ -565,8 +565,6 @@ definitions:
                 type: string
             APIPort:
                 type: string
-            AgentBackend:
-                type: string
             AllowedOrigin:
                 type: string
             AuthProvider:
@@ -585,9 +583,6 @@ definitions:
                 type: string
             Database:
                 type: string
-            DefaultNodeLimit:
-                format: int32
-                type: integer
             DisableRemoteIPCheck:
                 type: string
             DisplayKeys:
@@ -624,9 +619,6 @@ definitions:
                 type: string
             Server:
                 type: string
-            ServerCheckinInterval:
-                format: int64
-                type: integer
             Telemetry:
                 type: string
             Verbosity:

+ 0 - 1
test/config/environments/dev.yaml

@@ -4,7 +4,6 @@ server:
   masterkey: "secretkey"
   allowedorigin: "*"
   restbackend: true            
-  agentbackend: true
 mongoconn:
   user: "mongoadmin"
   pass: "mongopass"