improving client/server info command
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user