config default vars updated

This commit is contained in:
Ubuntu 2018-01-17 16:48:56 +00:00
parent 0de33322b4
commit 5b613d0324
5 changed files with 18 additions and 4 deletions

4
config/default.js Normal file
View File

@ -0,0 +1,4 @@
module.exports={
webhook: {URLEndpoint: "/autobounty/fund"},
bounty: {}
}

1
config/development.js Normal file
View File

@ -0,0 +1 @@
module.exports = {}

5
config/index.js Normal file
View File

@ -0,0 +1,5 @@
var _ = require("lodash");
var defaults = require("./default.js");
var config = require("./" + (process.env.NODE_ENV || "development") + ".js");
module.exports = _.merge({}, defaults, config);

View File

@ -8,13 +8,14 @@
* Depends on commiteth version as of 2017-06-10.
*/
const config = require('./config');
const SignerProvider = require('ethjs-provider-signer');
const sign = require('ethjs-signer').sign;
const Eth = require('ethjs-query');
const address = process.env.ADDRESS;
const name = process.env.NAME;
const webhook_secret = process.env.WEBHOOK_SECRET;
const provider = new SignerProvider(process.env.NODE, {
signTransaction: (rawTx, cb) => cb(null, sign(rawTx, process.env.KEY)),
@ -33,11 +34,13 @@ app.use(cors());
// Store issue ids and their bounty addresses
var issueData = {};
// Receive a POST request at the address specified by an env. var.
app.post(`/comment/${webhook_secret}`, jsonParser, function(req, res, next){
app.post(`${config.webhook.URLEndpoint}`, jsonParser, function(req, res, next){
if (!req.body)
return res.sendStatus(400);
var commentBody = req.body.comment.body;
return res.sendStatus(200)
/*var commentBody = req.body.comment.body;
var issueId = req.body.issue.id;
var namePosition = commentBody.search("@" + name);
// Store toAddress from commiteth
@ -81,7 +84,7 @@ app.post(`/comment/${webhook_secret}`, jsonParser, function(req, res, next){
}
});
});
}
}*/
});
const port = process.env.PORT || 8181

View File

@ -16,6 +16,7 @@
"ethjs-query": "^0.2.4",
"ethjs-signer": "^0.1.1",
"express": "^4.15.2",
"lodash": "^4.17.4",
"web3": "^0.18.2"
}
}