missing cert and key error message

This commit is contained in:
zadam 2019-04-08 20:08:29 +02:00
parent ef1b32d586
commit 83b4382787
2 changed files with 10 additions and 1 deletions

View File

@ -45,7 +45,8 @@ function calculateSmartValue(v) {
module.exports = function (searchText) {
// if the string doesn't start with attribute then we consider it as just standard full text search
if (!searchText.trim().startsWith("@")) {
const sanitizedSearchText = searchText.replace(/[^\w ]+/g, "");
// replace with space instead of empty string since these characters are probably separators
const sanitizedSearchText = searchText.replace(/[^\w ]+/g, " ");
return [
{

View File

@ -35,6 +35,14 @@ async function startTrilium() {
app.set('port', usedPort);
if (config['Network']['https']) {
if (!config['Network']['keyPath'] || !config['Network']['keyPath'].trim().length) {
throw new Error("keyPath in config.ini is required when https=true, but it's empty");
}
if (!config['Network']['certPath'] || !config['Network']['certPath'].trim().length) {
throw new Error("certPath in config.ini is required when https=true, but it's empty");
}
const options = {
key: fs.readFileSync(config['Network']['keyPath']),
cert: fs.readFileSync(config['Network']['certPath'])