forked from koii-network/task-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.js
34 lines (30 loc) · 812 Bytes
/
init.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
const express = require('express');
const TASK_NAME = process.argv[2] || 'Local';
const TASK_ID = process.argv[3];
const EXPRESS_PORT = process.argv[4] || 10000;
const NODE_MODE = process.argv[5];
const MAIN_ACCOUNT_PUBKEY = process.argv[6];
const SECRET_KEY = process.argv[7];
const K2_NODE_URL = process.argv[8];
const SERVICE_URL = process.argv[9];
const STAKE = Number(process.argv[10]);
const TASK_NODE_PORT = Number(process.argv[11]);
const app = express();
console.log('SETTING UP EXPRESS');
app.get('/', (req, res) => {
res.send('Hello World!');
});
app.listen(EXPRESS_PORT, () => {
console.log(`${TASK_NAME} listening on port ${EXPRESS_PORT}`);
});
module.exports = {
app,
NODE_MODE,
TASK_ID,
MAIN_ACCOUNT_PUBKEY,
SECRET_KEY,
K2_NODE_URL,
SERVICE_URL,
STAKE,
TASK_NODE_PORT
};