initial config support

develop
lub 7 years ago
parent c543f8245a
commit 5d0effd8f4

3
.gitignore vendored

@ -1,4 +1,5 @@
node_modules
package-lock.json
.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 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({
baseUrl: 'https://imninja.net',
accessToken: accesstoken,
userId: userid
baseUrl: config.baseurl,
accessToken: config.accesstoken,
userId: config.userid
});
/*matrixclient.on('RoomMember.membership', function(event, member) {