Write DB to application directory

This commit is contained in:
Gregory Schier 2016-04-27 16:33:38 -07:00
parent 24abf6f71f
commit 9fda6e79cf
2 changed files with 5 additions and 4 deletions

3
.gitignore vendored
View File

@ -3,9 +3,6 @@ node_modules
dist/*
build/*
# PouchDB stuff
*db.json
# Logs
logs
*.log

View File

@ -1,3 +1,6 @@
import * as fsPath from 'path'
import electron from 'electron'
// import PouchDB from 'pouchdb';
import * as methods from '../lib/constants';
import {generateId} from './util'
@ -28,7 +31,8 @@ export function initDB () {
}
return new Promise(resolve => {
db = new Loki('insomnia.db.json', {
const rootPath = electron.remote.app.getPath('appData');
db = new Loki(fsPath.join(rootPath, 'insomnia.db.json'), {
autoload: true,
autosave: true,
autosaveInterval: 500, // TODO: Make this a bit smarter maybe