Check config on load (#4170)

Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
Aya Morisawa
2019-02-06 22:44:55 +09:00
committed by syuilo
parent 41ba06a5e6
commit 96bc17aa10
19 changed files with 195 additions and 125 deletions

View File

@ -42,9 +42,10 @@ const index = {
};
// Init ElasticSearch connection
const client = config.elasticsearch ? new elasticsearch.Client({
host: `${config.elasticsearch.host}:${config.elasticsearch.port}`
}) : null;
const client = config.elasticsearch.map(({ host, port }) => {
return new elasticsearch.Client({ host: `${host}:${port}` });
}).getOrElse(null);
if (client) {
// Send a HEAD request