Skip to content

Commit

Permalink
remove versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
wardviaene committed Oct 15, 2024
1 parent c08f1c5 commit 725d20d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
1 change: 0 additions & 1 deletion rest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (c *Context) getRouter(assets fs.FS, indexHtml []byte) *http.ServeMux {
mux.Handle("/api/authmethods", http.HandlerFunc(c.authMethods))
mux.Handle("/api/authmethods/{method}/{id}", http.HandlerFunc(c.authMethodsByID))
mux.Handle("/api/authmethods/{id}", http.HandlerFunc(c.authMethodsByID))
mux.Handle("/api/version", http.HandlerFunc(c.version))
mux.Handle("/api/upgrade", http.HandlerFunc(c.upgrade))
mux.Handle("/", returnIndexOrNotFound(indexHtml))

Expand Down
21 changes: 0 additions & 21 deletions rest/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,14 @@ package rest

import (
_ "embed"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
)

//go:generate cp -r ../../latest ./resources/version
//go:embed resources/version

var version string

const UPGRADESERVER_URI = "127.0.0.1:8081"

func (c *Context) version(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodGet:
out, err := json.Marshal(map[string]string{"version": strings.TrimSpace(version)})
if err != nil {
c.returnError(w, fmt.Errorf("version marshal error: %s", err), http.StatusBadRequest)
return
}
c.write(w, out)
default:
c.returnError(w, fmt.Errorf("method not supported"), http.StatusBadRequest)
}
}

func (c *Context) upgrade(w http.ResponseWriter, r *http.Request) {
client := http.Client{
Timeout: 10 * time.Second,
Expand Down

0 comments on commit 725d20d

Please sign in to comment.