Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'The configuration of Web Myna is completed and saved. You can restart it, everything should work!',
);
} catch (error) {
signale.log(`Error when saving your configuration of the ${configurationLocation.configPath} file.`);
signale.error(error);
}
process.exit();
};
run();
} else {
const missingTokens = getMissingEnvironmentTokens();
if (missingTokens.length) {
const message = getMissingTokensMessage(config, missingTokens);
signale.log(boxen(message, { padding: 1, margin: 1, borderColor: 'red', align: 'center' }));
process.exit();
} else {
app.listen(config.proxyPort, () => {
signale.info(`Web Myna is starded on port ${config.proxyPort} in environment ${config.env}`);
});
}
}
process.on('SIGINT', function() {
clear();
signale.log(chalk.yellow(figlet.textSync('Bye', { horizontalLayout: 'full' })));
process.exit();
});
configureApi = apiConfiguration.continue;
}
clearWn();
const finalConfiguration = {
recordingsPath: configurationLocation.recordingsPath,
apis,
};
try {
if (!fs.existsSync(configurationLocation.recordingsPath)) {
fs.mkdirSync(configurationLocation.recordingsPath);
}
fs.writeFileSync(configurationLocation.configPath, JSON.stringify(finalConfiguration, null, 2), {
encoding: 'utf8',
});
signale.log(
'The configuration of Web Myna is completed and saved. You can restart it, everything should work!',
);
} catch (error) {
signale.log(`Error when saving your configuration of the ${configurationLocation.configPath} file.`);
signale.error(error);
}
process.exit();
};
const run = async () => {
const configurationLocation = await questions.askConfigurationLocation();
displayApiHelp();
let apis = [];
let configureApi = true;
while (configureApi) {
if (apis.length) {
signale.log(`You already have ${apis.length} api.s configured`);
}
const apiConfiguration = await questions.askApiConfiguration();
apis.push(omit(apiConfiguration, ['continue']));
configureApi = apiConfiguration.continue;
}
clearWn();
const finalConfiguration = {
recordingsPath: configurationLocation.recordingsPath,
apis,
};
try {
if (!fs.existsSync(configurationLocation.recordingsPath)) {
fs.mkdirSync(configurationLocation.recordingsPath);
}
fs.writeFileSync(configurationLocation.configPath, JSON.stringify(finalConfiguration, null, 2), {
const clearWn = () => {
clear();
signale.log(chalk.yellow(figlet.textSync('Web Myna', { horizontalLayout: 'full' })));
};
page.on("error", err => {
log.log("Error: " + err.toString());
});
}