make config global with global.config

develop
lub 7 years ago
parent 82b82bc4b5
commit cd6e262b39

@ -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) {

@ -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,