LoRaWAN-Signal-Mapping/server/bootstrap/database_init.mjs

17 lines
347 B
JavaScript
Raw Normal View History

"use strict";
import fs from 'fs';
import path from 'path';
import Database from 'better-sqlite3';
var db = null;
function init({ root_dir, settings: { database: { filename, options } } }) {
db = new Database(filename, options);
db.exec(fs.readFileSync(path.join(root_dir, "./db_template.sql"), "utf8"));
return db;
}
export default init;