From 4dbc097d5764a56c557f461644a8891d9ec69f8d Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 21 Nov 2018 00:00:55 +0100 Subject: [PATCH] proper health check --- index.js | 7 +++---- package.json | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index d177493..4e8f4a1 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ const createHafas = require('db-hafas') const createApi = require('hafas-rest-api') +const createHealthCheck = require('hafas-client-health-check') const pkg = require('./package.json') const stations = require('./lib/stations') @@ -10,10 +11,8 @@ const station = require('./lib/station') const hafas = createHafas(pkg.name) -const healthCheck = () => { - return hafas.station('8011306') - .then(st => !!st) -} +const berlinHbf = '8011160' +const healthCheck = createHealthCheck(hafas, berlinHbf) const config = { hostname: process.env.HOSTNAME || '2.db.transport.rest', diff --git a/package.json b/package.json index c368f7f..fe20f83 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "db-hafas": "^3.0.1", "db-stations": "^2.4.0", "db-stations-autocomplete": "^2.1.0", + "hafas-client-health-check": "^1.0.1", "hafas-rest-api": "^1.1.0", "ndjson": "^1.5.0" },