mirror of
				https://github.com/gravitl/netmaker.git
				synced 2025-10-28 03:01:48 +08:00 
			
		
		
		
	fixing get config
This commit is contained in:
		| @@ -48,9 +48,11 @@ func securityCheckServer(adminonly bool, next http.Handler) http.HandlerFunc { | |||||||
| 		} | 		} | ||||||
| 		if !adminonly && (err != nil || user == "") { | 		if !adminonly && (err != nil || user == "") { | ||||||
| 			returnErrorResponse(w, r, errorResponse) | 			returnErrorResponse(w, r, errorResponse) | ||||||
|  | 			return | ||||||
| 		}  | 		}  | ||||||
| 		if !isadmin && !authenticateMasterServer(authToken) { | 		if adminonly && !isadmin && !authenticateMasterServer(authToken) { | ||||||
| 			returnErrorResponse(w, r, errorResponse) | 			returnErrorResponse(w, r, errorResponse)W | ||||||
|  | 			return | ||||||
| 		} | 		} | ||||||
| 		next.ServeHTTP(w, r) | 		next.ServeHTTP(w, r) | ||||||
| 	} | 	} | ||||||
| @@ -88,23 +90,10 @@ func getConfig(w http.ResponseWriter, r *http.Request) { | |||||||
| 	// get params | 	// get params | ||||||
|  |  | ||||||
| 	scfg := servercfg.GetServerConfig() | 	scfg := servercfg.GetServerConfig() | ||||||
| 	w.WriteHeader(http.StatusOK) |  | ||||||
| 	json.NewEncoder(w).Encode(scfg) | 	json.NewEncoder(w).Encode(scfg) | ||||||
|  | 	//w.WriteHeader(http.StatusOK) | ||||||
| } | } | ||||||
|  |  | ||||||
| /* |  | ||||||
| func getMongoConfig(w http.ResponseWriter, r *http.Request) { |  | ||||||
|         // Set header |  | ||||||
|         w.Header().Set("Content-Type", "application/json") |  | ||||||
|  |  | ||||||
|         // get params |  | ||||||
|  |  | ||||||
|         mcfg := servercfg.GetMongoConfig() |  | ||||||
|         w.WriteHeader(http.StatusOK) |  | ||||||
|         json.NewEncoder(w).Encode(mcfg) |  | ||||||
| } |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| func addNetwork(w http.ResponseWriter, r *http.Request) { | func addNetwork(w http.ResponseWriter, r *http.Request) { | ||||||
| 	// Set header | 	// Set header | ||||||
| 	w.Header().Set("Content-Type", "application/json") | 	w.Header().Set("Content-Type", "application/json") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 afeiszli
					afeiszli