Merge branch 'sqlite3' of lubiland/heimdall into develop

develop
lub 7 years ago committed by Gitea
commit b17fc2dc6c

@ -3,6 +3,8 @@ matrix:
accesstoken: 't0ps3cr3t'
userid: '@jd:example.org'
database: '/home/qwer/heimdall.db'
infrastructure: '/home/qwer/scripts'
ssh:
key: '/home/qwer/.ssh/id_rsa'

@ -0,0 +1,13 @@
const dbtools = module.exports = {};
dbtools.createSchema = (db) => {
db.run('CREATE TABLE IF NOT EXISTS permissions ( \
id INTEGER PRIMARY KEY NOT NULL, \
mxid TEXT, \
omni INTEGER, \
project TEXT, \
service TEXT, \
subcommand TEXT, \
args TEXT \
)'); // the inner bracket for sql, the outer for closing the function*/
};

@ -1,6 +1,8 @@
const commands = require('./commands.js');
const dbtools = require('./dbtools.js');
const fs = require('fs');
const sdk = require('matrix-js-sdk');
const sqlite3 = require('sqlite3').verbose(); // .verbose until basics work
const yaml = require('js-yaml');
global.config = yaml.safeLoad(fs.readFileSync('config.yaml'));
@ -10,6 +12,9 @@ global.matrixClient = sdk.createClient({
userId: config.matrix.userid
});
const db = new sqlite3.Database(config.database);
dbtools.createSchema(db);
//captures unhandled rejections for easier debugging
process.on('unhandledRejection', (reason) => {
console.log('Reason: ' + reason);

@ -16,6 +16,7 @@
"babel-runtime": "^6.26.0",
"js-yaml": "^3.10.0",
"matrix-js-sdk": "^0.8.4",
"node-ssh": "^5.0.0"
"node-ssh": "^5.0.0",
"sqlite3": "^3.1.13"
}
}