mirror of
https://github.com/caprover/caprover
synced 2026-09-21 22:25:35 +00:00
Limiting namepace
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
* Created by kasra on 27/06/17.
|
||||
*/
|
||||
|
||||
import ApiStatusCodes from '../api/ApiStatusCodes'
|
||||
import CaptainConstants from '../utils/CaptainConstants'
|
||||
import DataStore from './DataStore'
|
||||
|
||||
const dataStoreCache: IHashMapGeneric<DataStore> = {}
|
||||
@@ -12,6 +14,13 @@ export default {
|
||||
throw new Error('NameSpace is empty')
|
||||
}
|
||||
|
||||
if (namespace !== CaptainConstants.rootNameSpace) {
|
||||
throw ApiStatusCodes.createError(
|
||||
ApiStatusCodes.STATUS_ERROR_GENERIC,
|
||||
'Namespace unknown'
|
||||
)
|
||||
}
|
||||
|
||||
if (!dataStoreCache[namespace]) {
|
||||
dataStoreCache[namespace] = new DataStore(namespace)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user