-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
40 lines (33 loc) · 983 Bytes
/
app.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
'use strict'
let BaseAppLoader = require('./base-app-loader'),
repoInfo = { name: 'imdb' },
mongooseDB = require('./base-lib/mongoose-db'),
JwtAuth = require('./lib/common/auth');
class AppLoader extends BaseAppLoader {
constructor() {
super(repoInfo);
}
updateConfigAndDependencies() {
let me = this;
me.applicationData.dependencies.db = mongooseDB.createConnection(me.applicationData.config.app_config.mongoose.connectionstring_imdb);
}
getSpecificPlugins(instanceConfig, config, dependencies) {
return [
{
plugin: JwtAuth,
options: { dependencies: dependencies, config: config }
}
];
}
registerSpecificStrategies(server, dependencies, config) {
server.auth.strategy('jwt-auth', 'jwt-auth', {
dependencies: dependencies,
config: config
});
}
async fetchConfig() {
this.applicationData.config = require('./config/config.json');
return true;
}
}
module.exports = AppLoader;