diff --git a/index.js b/index.js index 06e92bf..ae9eb7d 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const remoteExec = require('./remoteExec.js'); const sdk = require('matrix-js-sdk'); const yaml = require('js-yaml'); -const config = yaml.safeLoad(fs.readFileSync('config.yaml')); +global.config = yaml.safeLoad(fs.readFileSync('config.yaml')); const matrixClient = sdk.createClient({ baseUrl: config.matrix.baseurl, accessToken: config.matrix.accesstoken, @@ -35,7 +35,7 @@ commands['rebuild'].exec = function(args, room, event) { matrixClient.sendNotice(room.roomId, 'rebuilding container ' + container); - remoteExec('./rebuild.sh ' + container, config) + remoteExec('./rebuild.sh ' + container) .then(function(result) { matrixClient.sendNotice(room.roomId, event.sender.userId + '\nrebuilt container ' + container); }, function(result) { diff --git a/remoteExec.js b/remoteExec.js index 074d5a9..defc820 100644 --- a/remoteExec.js +++ b/remoteExec.js @@ -2,7 +2,7 @@ const nodeSsh = require('node-ssh'); const ssh = new nodeSsh(); -module.exports = (command, config) => { +module.exports = (command) => { return new Promise(function(resolve, reject) { ssh.connect({ host: config.ssh.host,