portíky
This commit is contained in:
parent
619a0b3256
commit
375a2e5850
1 changed files with 19 additions and 19 deletions
|
@ -1,24 +1,24 @@
|
|||
require('dotenv').config();
|
||||
const http = require('http');
|
||||
const crypto = require('crypto');
|
||||
const exec = require('child_process').exec;
|
||||
require('dotenv').config()
|
||||
const http = require('http')
|
||||
const crypto = require('crypto')
|
||||
const exec = require('child_process').exec
|
||||
|
||||
const secret = `${process.env.GITHUB_WEBHOOK}`;
|
||||
const repo = '/home/moover/MOOver';
|
||||
const secret = `${process.env.GITHUB_WEBHOOK}`
|
||||
const repo = '/home/moover/MOOver'
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
req.on('data', function (chunk) {
|
||||
const sig = 'sha1=' + crypto.createHmac('sha1', secret).update(chunk.toString()).digest('hex');
|
||||
const sig = 'sha1=' + crypto.createHmac('sha1', secret).update(chunk.toString()).digest('hex')
|
||||
if (req.headers['x-hub-signature'] == sig) {
|
||||
console.log('updating moover...');
|
||||
exec(`pm2 stop 'MOOver - main' && cd ${repo} && git pull && npm install && pm2 start 'MOOver - main'`);
|
||||
console.log('Success!');
|
||||
console.log('updating moover...')
|
||||
exec(`pm2 stop 'MOOver - main' && cd ${repo} && git pull && npm install && pm2 start 'MOOver - main'`)
|
||||
console.log('Success!')
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
res.end('Hello World\n');
|
||||
|
||||
}).listen(5050, '127.0.0.1', () => {
|
||||
console.log('Server is running');
|
||||
});
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' })
|
||||
res.end('Hello World\n')
|
||||
// HOST: losslessly-api.djkato.net/moover
|
||||
}).listen(7481, '127.0.0.1', () => {
|
||||
console.log('Server is running')
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue