mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
240c6a77a1
feat: options are now typed - This makes it easier to know what to send to unleash.start / unleash.create - Using a Partial to instantiate the config, then melding it with defaults to get a config object with all fields set either to their defaults or to whatever is passed in. Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
27 lines
642 B
TypeScript
27 lines
642 B
TypeScript
import { Knex } from 'knex';
|
|
import { IUnleashStores } from '../types/stores';
|
|
import { IUnleashConfig } from '../types/option';
|
|
import { Logger } from '../logger';
|
|
|
|
class HealthService {
|
|
private db: Knex;
|
|
|
|
private logger: Logger;
|
|
|
|
constructor(
|
|
{ db }: Pick<IUnleashStores, 'db'>,
|
|
{ getLogger }: Pick<IUnleashConfig, 'getLogger'>,
|
|
) {
|
|
this.db = db;
|
|
this.logger = getLogger('services/health-service.ts');
|
|
}
|
|
|
|
async dbIsUp(): Promise<boolean> {
|
|
const row = await this.db.raw('select 1');
|
|
return !!row;
|
|
}
|
|
}
|
|
|
|
export default HealthService;
|
|
module.exports = HealthService;
|