-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
24 lines (24 loc) · 1.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module.exports = {
setup: async () => {
if (process.env.USAGE_STORAGE) {
const Storage = require('@userdashboard/dashboard/src/storage.js')
const storage = await Storage.setup('USAGE')
const StorageList = require('@userdashboard/dashboard/src/storage-list.js')
const storageList = await StorageList.setup(storage, 'USAGE')
const StorageObject = require('@userdashboard/dashboard/src/storage-object.js')
const storageObject = await StorageObject.setup(storage, 'USAGE')
module.exports.Storage = storage
module.exports.StorageList = storageList
module.exports.StorageObject = storageObject
} else {
const dashboard = require('@userdashboard/dashboard')
module.exports.Storage = dashboard.Storage
module.exports.StorageList = dashboard.StorageList
module.exports.StorageObject = dashboard.StorageObject
}
global.sitemap['/api/administrator/usage/track-metric'].api.startTimers()
if (process.env.NODE_ENV === 'testing') {
module.exports.flushMetrics = global.sitemap['/api/administrator/usage/track-metric'].api.flushMetrics
}
}
}