make config global with global.config

master
lub 7 years ago
parent a8d9a0f95a
commit 423932d7f1

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