Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

fix: drive log files were missing upon setup #428

Merged
merged 4 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/listr/tasks/setup/setupLocalPresetTaskFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ function setupLocalPresetTaskFactory(
});
}

config.set('platform.drive.abci.log.prettyFile.path', path.join(os.tmpdir(), `/drive_pretty_${nodeIndex}.log`));
config.set('platform.drive.abci.log.jsonFile.path', path.join(os.tmpdir(), `/drive_json_${nodeIndex}.log`));
const drivePrettyLogFile = path.join(os.tmpdir(), `drive_pretty_${nodeIndex}.log`);
const driveJsonLogFile = path.join(os.tmpdir(), `drive_json_${nodeIndex}.log`);

config.set('platform.drive.abci.log.prettyFile.path', drivePrettyLogFile);
config.set('platform.drive.abci.log.jsonFile.path', driveJsonLogFile);
}
},
}
Expand Down
10 changes: 10 additions & 0 deletions src/listr/tasks/startNodeTaskFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,23 @@ function startNodeTaskFactory(
if (config.has('platform')) {
const prettyFilePath = config.get('platform.drive.abci.log.prettyFile.path');

// Remove directory that could potentially be created by Docker mount
if (fs.lstatSync(prettyFilePath).isDirectory()) {
fs.rmdirSync(prettyFilePath, { recursive: true });
}

if (!fs.existsSync(prettyFilePath)) {
fs.mkdirSync(path.dirname(prettyFilePath), { recursive: true });
fs.writeFileSync(prettyFilePath, '');
}

const jsonFilePath = config.get('platform.drive.abci.log.jsonFile.path');

// Remove directory that could potentially be created by Docker mount
if (fs.lstatSync(jsonFilePath).isDirectory()) {
fs.rmdirSync(jsonFilePath, { recursive: true });
}

if (!fs.existsSync(jsonFilePath)) {
fs.mkdirSync(path.dirname(jsonFilePath), { recursive: true });
fs.writeFileSync(jsonFilePath, '');
Expand Down