-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
62 lines (60 loc) · 1.83 KB
/
config.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
56
57
58
59
60
61
62
/**
* 系统配置
* @module
* @author zccz14 <[email protected]>
*/
// 配置查阅索引(重要)
// system.mongodb:
// http://mongodb.github.io/node-mongodb-native/2.2/reference/connecting/connection-settings/
// system.morgan: https://github.com/expressjs/morgan
// system.session: https://github.com/expressjs/session
/**
* @typedef {Object} SystemConfiguration
* @prop {URL} system.mongodb MongoDB URL
* @prop {URL} originFrontEnt 远程前端 URL
* @prop {String} environment 部署环境 "production" 或是 "development"
*/
/**
* @readonly
* @type {SystemConfiguration}
* @member
*/
const configuration = {
originFrontEnds: [
'https://function-x.github.io', // Allow API ref
'http://127.0.0.1:8080', // Temporarily Local Debugging
'http://localhost:8080', // Temporarily Local Debugging
],
system: {
assets: { path: require('path').join(__dirname, 'assets') },
mongodb: {
URI: 'mongodb://' + (process.env.MONGO_SERVER || 'localhost:27017') + '/OrangeJuice'
},
morgan: { format: 'dev', options: {} },
// Store the password in encrypted
// You can customize the hash algorithm
passwordHash: {
store: function (clearPassword) {
// DO NOT CHANGE IT after deployed!!!
// Or your users should reset their password
return require('crypto')
.createHash('sha1') // Hash Algorithm
.update(clearPassword)
.digest('hex');
},
// return true if the clearPassword is true
verify: function (clearPassword, encryptedPassword) {
return configuration.system.passwordHash.store(clearPassword) ===
encryptedPassword;
}
},
session: {
secret: 'ORANGEJUICE',
key: 'OJID',
resave: false,
saveUninitialized: true
},
defaultPort: 2048
}
};
module.exports = configuration;