initial config support

master
lub 7 years ago committed by lub
parent 139310825d
commit 510fa3e900

1
.gitignore vendored

@ -2,3 +2,4 @@ node_modules
package-lock.json package-lock.json
.idea .idea
*.log *.log
config.yaml

@ -0,0 +1,3 @@
baseurl: 'https://example.org'
accesstoken: 't0ps3cr3t'
userid: '@jd:example.org'

@ -1,12 +1,14 @@
const spawn = require('child_process').spawn; const fs = require('fs');
const sdk = require('matrix-js-sdk'); const sdk = require('matrix-js-sdk');
const spawn = require('child_process').spawn;
const yaml = require('js-yaml');
const config = yaml.safeLoad(fs.readFileSync('config.yaml'));
var userid = '';
var accesstoken = '';
var matrixclient = sdk.createClient({ var matrixclient = sdk.createClient({
baseUrl: 'https://imninja.net', baseUrl: config.baseurl,
accessToken: accesstoken, accessToken: config.accesstoken,
userId: userid userId: config.userid
}); });
/*matrixclient.on('RoomMember.membership', function(event, member) { /*matrixclient.on('RoomMember.membership', function(event, member) {