moving a function and struct over to a common library, starting on lockfile for server

This commit is contained in:
2020-06-07 23:26:13 -04:00
parent 6d738b138d
commit b2238657c8
12 changed files with 123 additions and 119 deletions

View File

@@ -1,6 +1,7 @@
package engine
import (
"fmt"
"net/http"
"github.com/labstack/echo"
@@ -18,16 +19,26 @@ func (Server *GVCServer) GetInfo(context echo.Context) error {
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 = ""
for i := range repoInfo.Repo.KnownClients { // Blank out the client keys
repoInfo.Repo.KnownClients[i].Key = "REDACTED"
}
repoInfo.Repo.KnownClients = clients
}
}
return context.JSONPretty(http.StatusAccepted, repoInfo, " ")
}
// LockFile just locks the file/folder/wildcard
func (Server *GVCServer) LockFile(context echo.Context) error {
fileType := context.Param("type")
fileName := context.Param("name")
switch fileType {
case "file":
//common.CheckFileTypes(fileName, fileType,)
fmt.Println("Filename: ", fileName)
}
return nil
}
// Hello just verifies the server is running //TODO remove this, just extra shit we are sending
func (Server *GVCServer) Hello(context echo.Context) error {
helloMsg := "server alive"