pre-create and chmod 600 data file (#182)

This commit is contained in:
Kyle Spearrin 2020-10-01 14:13:51 -04:00 committed by GitHub
parent f30d6f8027
commit 9216a8ead7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -22,6 +22,10 @@ export class LowdbStorageService implements StorageService {
NodeUtils.mkdirpSync(dir, '700');
}
this.dataFilePath = path.join(dir, 'data.json');
if (!fs.existsSync(this.dataFilePath)) {
fs.writeFileSync(this.dataFilePath, '', { mode: 0o600 });
fs.chmodSync(this.dataFilePath, 0o600);
}
adapter = new FileSync(this.dataFilePath);
}
try {