-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (29 loc) · 819 Bytes
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
/* eslint import/no-extraneous-dependencies:0, import/no-unresolved:0, global-require:0 */
const HydraPlugin = require('hydra/plugin')
class HydraHttpPlugin extends HydraPlugin {
constructor (config = {}) {
super('hydra-plugin-http')
this.config = config
}
setHydra (hydra) {
super.setHydra(hydra)
}
setConfig (hConfig) {
super.setConfig(hConfig)
this.config.hydra = hConfig
this.configChanged(this.opts)
}
configChanged (opts = {}) {
this.config = Object.assign(this.config, opts)
}
onServiceReady () {
this.hydra.http = {
request: require('./libs/request')(this.hydra, this.config),
proxy: require('./libs/proxy')(this.hydra, this.config),
lb: require('./libs/lb')(this.hydra, this.config)
}
}
}
module.exports = {
HydraHttpPlugin
}