Rename restapi to api (#3176)

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia
2023-12-26 15:07:30 -06:00
committed by GitHub
parent 8aa0ec17c5
commit 616f262d09
733 changed files with 396 additions and 372 deletions

View File

@@ -30,8 +30,8 @@ import (
"time"
"github.com/go-openapi/loads"
"github.com/minio/console/restapi"
"github.com/minio/console/restapi/operations"
"github.com/minio/console/api"
"github.com/minio/console/api/operations"
)
var token string
@@ -55,10 +55,10 @@ func inspectHTTPResponse(httpResponse *http.Response) string {
return "Http Response: " + string(b)
}
func initConsoleServer() (*restapi.Server, error) {
func initConsoleServer() (*api.Server, error) {
// os.Setenv("CONSOLE_MINIO_SERVER", "localhost:9000")
swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON)
swaggerSpec, err := loads.Embedded(api.SwaggerJSON, api.FlatSwaggerJSON)
if err != nil {
return nil, err
}
@@ -68,24 +68,24 @@ func initConsoleServer() (*restapi.Server, error) {
}
// Initialize MinIO loggers
restapi.LogInfo = noLog
restapi.LogError = noLog
api.LogInfo = noLog
api.LogError = noLog
api := operations.NewConsoleAPI(swaggerSpec)
api.Logger = noLog
consoleAPI := operations.NewConsoleAPI(swaggerSpec)
consoleAPI.Logger = noLog
server := restapi.NewServer(api)
server := api.NewServer(consoleAPI)
// register all APIs
server.ConfigureAPI()
// restapi.GlobalRootCAs, restapi.GlobalPublicCerts, restapi.GlobalTLSCertsManager = globalRootCAs, globalPublicCerts, globalTLSCerts
// api.GlobalRootCAs, api.GlobalPublicCerts, api.GlobalTLSCertsManager = globalRootCAs, globalPublicCerts, globalTLSCerts
consolePort, _ := strconv.Atoi("9090")
server.Host = "0.0.0.0"
server.Port = consolePort
restapi.Port = "9090"
restapi.Hostname = "0.0.0.0"
api.Port = "9090"
api.Hostname = "0.0.0.0"
return server, nil
}