aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/object-storage-proxy.ts
blob: bbd77f2629bb33a94bd3081ca40a4283d55bc22a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import express from 'express'
import { CONFIG } from '@server/initializers/config'
import { HttpStatusCode } from '@shared/models'

const ensurePrivateObjectStorageProxyIsEnabled = [
  (req: express.Request, res: express.Response, next: express.NextFunction) => {
    if (CONFIG.OBJECT_STORAGE.PROXY.PROXIFY_PRIVATE_FILES !== true) {
      return res.fail({
        message: 'Private object storage proxy is not enabled',
        status: HttpStatusCode.BAD_REQUEST_400
      })
    }

    return next()
  }
]

export {
  ensurePrivateObjectStorageProxyIsEnabled
}