Skip to content

Commit 7036b74

Browse files
committed
Move hflowStartServer to wfRun.js module
1 parent 4912e9d commit 7036b74

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

bin/hflow.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env node
22

3-
var redisURL = process.env.REDIS_URL ? {url: process.env.REDIS_URL} : undefined
4-
53
var docopt = require('docopt').docopt;
64

75
var doc = "\
@@ -25,22 +23,9 @@ if (opts['--submit']) {
2523
return;
2624
}
2725

28-
var fs = require('fs'),
29-
pathtool = require('path'),
30-
redis = require('redis'),
31-
rcl = redisURL ? redis.createClient(redisURL): redis.createClient(),
32-
wflib = require('../wflib').init(rcl),
33-
Engine = require('../engine2'),
34-
async = require('async'),
35-
AdmZip = require('adm-zip'),
36-
dbId = 0,
37-
plugins = [],
38-
recoveryMode = false, recoveryData = { 'input': [], 'outputs': {}, 'settings': {} },
39-
glob = require('glob'),
40-
wfDirFull,
41-
hflowRun = require('../common/wfRun.js').hflowRun;
26+
var hflowRun = require('../common/wfRun.js').hflowRun,
27+
hflowStartServer = require('../common/wfRun.js').hflowStartServer;
4228

43-
var hfroot = pathtool.join(require('path').dirname(require.main.filename), "..");
4429

4530
// Workflow variables TODO: add support for config files
4631

@@ -73,14 +58,6 @@ function hflowSubmit(opts) {
7358
});
7459
}
7560

76-
function hflowStartServer() {
77-
var server = require('../server/hyperflow-server.js')(rcl, wflib, plugins);
78-
let hostname = '127.0.0.1', port = process.env.PORT;
79-
server.listen(port, () => {
80-
console.log("HyperFlow server started, app factory URI: http://%s:%d/apps", server.address().address, server.address().port);
81-
});
82-
}
83-
8461
function hflowSend(opts) {
8562
console.log("send signal to a workflow: not implemented");
8663
}

common/wfRun.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,16 @@ function handle_writes(entries, cb) {
6666
});
6767
}
6868

69-
function hflow_start() {
70-
var server = require('../server/hyperflow-server.js')(rcl, wflib, plugins);
71-
server.listen(process.env.PORT, function() { });
72-
console.log("HyperFlow server started, app factory URI: http://%s:%d/apps", server.address().address, server.address().port);
69+
function hflowStartServer() {
70+
var server = require('../server/hyperflow-server.js')(rcl, wflib);
71+
let hostname = '127.0.0.1', port = process.env.PORT;
72+
server.listen(port, hostname, () => {
73+
console.log("HyperFlow server started at: http://%s:%d", server.address().address, server.address().port);
74+
});
7375
}
7476

77+
78+
7579
/*
7680
** Function hflowRun: run a workflow
7781
**
@@ -291,4 +295,5 @@ function hflowSend() {
291295
console.log("send signal to a workflow: not implemented");
292296
}
293297

294-
exports.hflowRun = hflowRun;
298+
exports.hflowRun = hflowRun;
299+
exports.hflowStartServer = hflowStartServer;

0 commit comments

Comments
 (0)