-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver-common.js
55 lines (49 loc) · 1.31 KB
/
server-common.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict'
const HapiPinoPlugin = require('./src/shared/plugins/hapi-pino.plugin.js')
const ResetPasswordConfig = require('shared/lib/ResetPasswordConfig')
const UpdatePasswordConfig = require('shared/lib/UpdatePasswordConfig')
const CatboxRedis = require('@hapi/catbox-redis')
const createPlugins = (config, connectors) => {
const plugins = [
require('@hapi/scooter'),
require('@hapi/inert'),
require('@hapi/vision'),
{
plugin: require('hapi-sanitize-payload'),
options: config.sanitize
},
{
plugin: require('blankie'),
options: config.blankie
},
{
plugin: require('@hapi/yar'),
options: config.yar
},
{
plugin: require('shared/plugins/reset-password'),
options: new ResetPasswordConfig(config, connectors)
},
{
plugin: require('shared/plugins/update-password'),
options: new UpdatePasswordConfig(config, connectors)
},
{
plugin: require('shared/lib/session-forms').plugin
}
]
plugins.push(HapiPinoPlugin(config.log.logInTest, config.log.logAssetRequests))
return plugins
}
const createCache = config => {
return [
{
provider: {
constructor: CatboxRedis,
options: config.redis
}
}
]
}
exports.createPlugins = createPlugins
exports.createCache = createCache