Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asclepius-standard

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asclepius-standard - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0-alpha.0

README.md

36

index.js
const asclepius = require('asclepius');
const nullLogger = require('null-logger');
const sequelizeHealthcheck = (sequelize, logger = nullLogger) => asclepius.healthcheck(
const defaultTimeout = 500;
const sequelizeHealthcheck = (sequelize, logger = nullLogger, timeout = defaultTimeout) => asclepius.healthcheck(
'psql',

@@ -14,6 +16,6 @@ () =>

}),
500
timeout
);
const redisHealthcheck = (redis, logger = nullLogger) => asclepius.healthcheck(
const redisHealthcheck = (redis, logger = nullLogger, timeout = defaultTimeout) => asclepius.healthcheck(
'redis',

@@ -30,6 +32,6 @@ () =>

}),
500
timeout
);
const elasticsearchHealthcheck = (elasticsearch, logger = nullLogger) => asclepius.healthcheck(
const elasticsearchHealthcheck = (elasticsearch, logger = nullLogger, timeout = defaultTimeout) => asclepius.healthcheck(
'elasticsearch',

@@ -44,3 +46,3 @@ () =>

}),
500
timeout
);

@@ -51,14 +53,24 @@

() => Promise.resolve(),
500
defaultTimeout
);
module.exports = {
setup: ({ sequelize = null, redis = null, elasticsearch = null, logger = nullLogger } = {}) => {
const _buildHealthCheckArray = ({ sequelize = null, redis = null, elasticsearch = null, logger = nullLogger, timeout = defaultTimeout } = {}) => {
const healthchecks = [processHealthcheck];
if (sequelize) healthchecks.push(sequelizeHealthcheck(sequelize, logger));
if (elasticsearch) healthchecks.push(elasticsearchHealthcheck(elasticsearch, logger));
if (redis) healthchecks.push(redisHealthcheck(redis, logger));
if (sequelize) healthchecks.push(sequelizeHealthcheck(sequelize, logger, timeout));
if (elasticsearch) healthchecks.push(elasticsearchHealthcheck(elasticsearch, logger, timeout));
if (redis) healthchecks.push(redisHealthcheck(redis, logger, timeout));
return healthchecks;
}
module.exports = {
setup: ({ sequelize = null, redis = null, elasticsearch = null, logger = nullLogger, timeout = defaultTimeout } = {}) => {
const healthchecks = _buildHealthCheckArray({ sequelize, redis, elasticsearch, logger, timeout });
return asclepius.makeRoute(healthchecks);
},
runner: ({ sequelize = null, redis = null, elasticsearch = null, logger = nullLogger, timeout = defaultTimeout } = {}) => {
const healthchecks = _buildHealthCheckArray({ sequelize, redis, elasticsearch, logger, timeout });
return asclepius.makeRunner(healthchecks);
}
};
{
"name": "asclepius-standard",
"version": "1.0.2",
"version": "1.1.0-alpha.0",
"description": "Asclepius Standard Configuration",

@@ -5,0 +5,0 @@ "repository": "git@github.com:ordermentum/asclepius-standard.git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc