improving client/server info command

This commit is contained in:
2020-06-07 18:31:01 -04:00
parent dd3fd7c4ae
commit 6d738b138d
12 changed files with 72 additions and 31 deletions

View File

@@ -9,7 +9,23 @@ import (
// GetInfo return the relevant repo specific info to the client
func (Server *GVCServer) GetInfo(context echo.Context) error {
repo := context.Param("repoName")
return context.JSON(http.StatusAccepted, repo)
config := Server.Config
var repoInfo RepoInfoRequest // Create an engine struct that contains basic server info as well as all repo info
for _, knownRepo := range config.Repos {
if knownRepo.RepoName == repo {
repoInfo.BindIP = config.BindIP
repoInfo.Port = config.Port
repoInfo.RawPort = config.RawPort
repoInfo.Version = config.Version
repoInfo.Repo = knownRepo
clients := repoInfo.Repo.KnownClients
for _, client := range clients { // Blank out the client keys
client.Key = ""
}
repoInfo.Repo.KnownClients = clients
}
}
return context.JSONPretty(http.StatusAccepted, repoInfo, " ")
}
// Hello just verifies the server is running //TODO remove this, just extra shit we are sending