2020-07-12 23:00:47 +00:00
|
|
|
package legacy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
|
|
|
)
|
|
|
|
|
2020-07-13 09:51:21 +00:00
|
|
|
func AttachS3API(r *mux.Router, obj ObjectLayer) {
|
2020-07-12 23:00:47 +00:00
|
|
|
// Add healthcheck router
|
2020-07-13 09:51:21 +00:00
|
|
|
registerHealthCheckRouter(r)
|
2020-07-12 23:00:47 +00:00
|
|
|
|
|
|
|
// Add server metrics router
|
2020-07-13 09:51:21 +00:00
|
|
|
registerMetricsRouter(r)
|
2020-07-12 23:00:47 +00:00
|
|
|
|
|
|
|
// Add API router.
|
2020-07-13 09:51:21 +00:00
|
|
|
registerAPIRouter(r, true, true)
|
2020-07-12 23:00:47 +00:00
|
|
|
|
|
|
|
layer := NewGatewayLayerWithLocker(obj)
|
|
|
|
|
|
|
|
// Once endpoints are finalized, initialize the new object api in safe mode.
|
|
|
|
globalObjLayerMutex.Lock()
|
|
|
|
globalSafeMode = true
|
|
|
|
globalObjectAPI = layer
|
|
|
|
globalObjLayerMutex.Unlock()
|
|
|
|
|
|
|
|
// Calls all New() for all sub-systems.
|
|
|
|
newAllSubsystems()
|
|
|
|
|
|
|
|
// Verify if object layer supports
|
|
|
|
// - encryption
|
|
|
|
// - compression
|
|
|
|
verifyObjectLayerFeatures("gateway NeoFS", layer)
|
|
|
|
|
|
|
|
// Disable safe mode operation, after all initialization is over.
|
|
|
|
globalObjLayerMutex.Lock()
|
|
|
|
globalSafeMode = false
|
|
|
|
globalObjLayerMutex.Unlock()
|
|
|
|
}
|