Refactor and doc
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/config"
|
||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||
)
|
||||
|
||||
@@ -51,11 +52,11 @@ type API struct{}
|
||||
// GetState returns the state of the API
|
||||
func (a *API) GetState() (State, int, error) {
|
||||
// Check if the database is up
|
||||
err := mongo.MONGOService.TestDB(GetConfig())
|
||||
err := mongo.MONGOService.TestDB(config.GetConfig())
|
||||
if err != nil {
|
||||
return DB_FALLOUT, 200, err // If the database is not up, return database fallout
|
||||
}
|
||||
err = mongo.MONGOService.TestCollections(GetConfig(), []string{}) // Check if the collections are up
|
||||
err = mongo.MONGOService.TestCollections(config.GetConfig(), []string{}) // Check if the collections are up
|
||||
if err != nil {
|
||||
return UNPROCESSABLE_ENTITY, 200, err // If the collections are not up, return unprocessable entity
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user