configs mostly working. Need to add in public dns default check.

This commit is contained in:
afeiszli
2021-05-05 22:03:37 +00:00
parent 46a81c9767
commit de3d81db3a
10 changed files with 163 additions and 210 deletions

View File

@@ -2,9 +2,8 @@ package functions
import (
"time"
"os"
"github.com/gravitl/netmaker/config"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/servercfg"
"github.com/dgrijalva/jwt-go"
)
@@ -51,7 +50,7 @@ func CreateUserJWT(username string, isadmin bool) (response string, err error) {
func VerifyUserToken(tokenString string) (username string, isadmin bool, err error) {
claims := &models.UserClaims{}
if tokenString == config.Config.Server.MasterKey || (tokenString == os.Getenv("MASTER_KEY") && tokenString != "") {
if tokenString == servercfg.GetMasterKey() {
return "masteradministrator", true, nil
}
@@ -71,7 +70,7 @@ func VerifyToken(tokenString string) (macaddress string, network string, err err
//this may be a stupid way of serving up a master key
//TODO: look into a different method. Encryption?
if tokenString == config.Config.Server.MasterKey || (tokenString == os.Getenv("MASTER_KEY") && tokenString != "") {
if tokenString == servercfg.GetMasterKey() {
return "mastermac", "", nil
}