1 | var Base = require('../base')
|
2 | , Publisher = require('./publisher')
|
3 | , Connector = require('./connector')
|
4 | , Crypto = require('./crypto')
|
5 |
|
6 |
|
7 | exports.start = function(ixApiDir){
|
8 | Base.env(function(){
|
9 | Publisher.publishAndFindProxy(ixApiDir, function(err, data){
|
10 | if (err) { throw err }
|
11 | Connector.connectToProxy(data, function(err, data){
|
12 | if (err) { throw err }
|
13 | })
|
14 | })
|
15 | })
|
16 | }
|
17 |
|
18 | exports.startHttpProxy = function(upstreamUrl){
|
19 | Base.env(function(){
|
20 | Publisher.publishHttpAndFindProxy(function(err, data){
|
21 | if (err) { throw err }
|
22 | Connector.connectHttpToProxy(upstreamUrl, data, function(err, data){
|
23 | if (err) { throw err }
|
24 | })
|
25 | })
|
26 | })
|
27 | }
|
28 |
|
29 | exports.setKey = function(key){
|
30 | Crypto.setKey(key)
|
31 | }
|