Skip to content
Merged
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
32 changes: 15 additions & 17 deletions packages/dashmate/src/commands/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,30 @@ class SetupCommand extends BaseCommand {
initial: PRESET_MAINNET,
},
]);
}

let isAlreadyConfigured;
if (ctx.preset === PRESET_LOCAL) {
isAlreadyConfigured = configFile.isGroupExists(ctx.preset);
} else {
const systemConfig = new Config(ctx.preset, systemConfigs[ctx.preset]);
let isAlreadyConfigured;
if (ctx.preset === PRESET_LOCAL) {
isAlreadyConfigured = configFile.isGroupExists(ctx.preset);
} else {
const systemConfig = new Config(ctx.preset, systemConfigs[ctx.preset]);

isAlreadyConfigured = !configFile.getConfig(ctx.preset).isEqual(systemConfig);
}
isAlreadyConfigured = !configFile.getConfig(ctx.preset).isEqual(systemConfig);
}

if (isAlreadyConfigured) {
// eslint-disable-next-line no-param-reassign
task.output = chalk`Preset {bold ${ctx.preset}} already configured.
if (isAlreadyConfigured) {
// eslint-disable-next-line no-param-reassign
task.output = chalk`Preset {bold ${ctx.preset}} already configured.

To set up a node with this preset from scratch use {bold.cyanBright dashmate reset --config ${ctx.preset} --hard}.
Previous data and configuration for this preset will be lost.

If you want to keep the existing data and configuration, please use the {bold.cyanBright dashmate config create}
command to create a new configuration for this preset.`;
throw new Error(`Preset ${ctx.preset} already configured`);
} else {
// eslint-disable-next-line no-param-reassign

// eslint-disable-next-line no-param-reassign
task.output = ctx.preset;
}
throw new Error(`Preset ${ctx.preset} already configured`);
} else {
// eslint-disable-next-line no-param-reassign
Comment thread
shuplenkov marked this conversation as resolved.
task.output = ctx.preset;
}
},
options: {
Expand Down