Start refactoring

This commit is contained in:
Aurélie Delhaie
2023-05-29 17:44:50 +02:00
parent 55ac50f3be
commit c06843cd28
31 changed files with 1125 additions and 1267 deletions

View File

@@ -2,7 +2,6 @@ package server
import (
"net/http"
"opensavecloudserver/config"
"opensavecloudserver/constant"
"runtime"
)
@@ -10,20 +9,20 @@ import (
type information struct {
AllowRegister bool `json:"allow_register"`
Version string `json:"version"`
ApiVersion int `json:"api_version"`
APIVersion int `json:"api_version"`
GoVersion string `json:"go_version"`
OsName string `json:"os_name"`
OsArchitecture string `json:"os_architecture"`
OSName string `json:"os_name"`
OSArchitecture string `json:"os_architecture"`
}
func Information(w http.ResponseWriter, r *http.Request) {
func (s *HTTPServer) Information(w http.ResponseWriter, r *http.Request) {
info := information{
AllowRegister: config.Features().AllowRegister,
AllowRegister: s.config.Features.AllowRegister,
Version: constant.Version,
ApiVersion: constant.ApiVersion,
APIVersion: constant.ApiVersion,
GoVersion: runtime.Version(),
OsName: runtime.GOOS,
OsArchitecture: runtime.GOARCH,
OSName: runtime.GOOS,
OSArchitecture: runtime.GOARCH,
}
ok(info, w, r)
ok(info, w)
}