1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-26 17:08:33 +01:00

config for storage

This commit is contained in:
Kyle Spearrin 2018-02-15 14:05:37 -05:00
parent 3ea4842351
commit 4336212a00

View File

@ -1,8 +1,23 @@
import { StorageService } from 'jslib/abstractions';
import { StorageService } from 'jslib/abstractions/storage.service';
import { ConstantsService } from 'jslib/services/constants.service';
// tslint:disable-next-line
const Store = require('electron-store');
const store = new Store();
const storeConfig: any = {
defaults: {} as any,
name: 'bitwarden-data',
};
// Default lock options to "on restart".
storeConfig.defaults[ConstantsService.lockOptionKey] = -1;
// Portable builds should not use app data
if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
storeConfig.cwd = process.env.PORTABLE_EXECUTABLE_DIR;
}
const store = new Store(storeConfig);
export class DesktopStorageService implements StorageService {
get<T>(key: string): Promise<T> {