-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.default.js
66 lines (65 loc) · 2.45 KB
/
config.default.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
63
64
65
66
'use strict';
/**
* grpc config
* @member Config#grpc
* @property {String} dir - proto files dir, relative path
* @property {String} property - default attach to `ctx.grpc.**`,与object.key同名,存在多个实例时需要配置该项
* @property {Object} loadOpts - options pass to `grpc.load(file, type, opts)`
* @property {Boolean} loadOpts.convertFieldsToCamelCase - default to true, `string user_name` -> `userName`
* @property {Object} clientOpts - options pass to `new Client(host, credentials, opts)`
* @property {String} endpoint - default andress to connect, for debug or showcase purpose
* @property {Number} timeout - default 5000ms
* @property {Boolean} clientSsl.enable - enable client ssl
* @property {Buffer} clientSsl.rootCerts - The root certificate data file path,作为grpc client时仅提供该项作为证书即可
* @property {Buffer} clientSsl.privateKey - The client certificate private key file path, if applicable
* @property {Buffer} clientSsl.certChain - The client certificate cert chain file path, if applicable
* @property {Object} clientSsl.verifyOptions - Additional peer verification options, if desired
* @property {Object} clientSsl.options - 主要用于grpc.ssl_target_name_override和grpc.default_authority的配置
*/
exports.grpc = {
default: {
dir: 'app/proto',
property: 'grpc',
loadOpts: {
convertFieldsToCamelCase: true,
},
clientOpts: {},
endpoint: 'localhost:50051',
timeout: 5000,
/**
* 2019-12-03 by 张晓东
* 通过扩展原有配置的形式,使其支持tls/ssl安全
*/
clientSsl: {
enable: false,
// grpc.credentials.createSsl
// config/grpc/cert.server.crt
rootCerts: '', //
privateKey: '', // 作为grpc client时无需填写
certChain: '', // 作为grpc client时无需填写
verifyOptions: {},
options: {
'grpc.ssl_target_name_override': 'example.server',
'grpc.default_authority': 'example.server',
},
},
},
// clients: {
// // this.ctx.grpc1
// grpc1: {
// property: 'grpc1',
// dir: 'grpc',
// // 服务端地址
// endpoint: 'localhost:8090',
// clientSsl: {
// enable: true,
// // grpc.credentials.createSsl
// rootCerts: 'grpc/cert/server.crt',
// options: {
// "grpc.ssl_target_name_override": 'example.server',
// "grpc.default_authority": 'example.server'
// }
// }
// },
// }
};