UNPKG

nodejs-health-checker

Version:

Simple Nodejs package to simplify applications based in Node, to trace the healthy of the pods

21 lines 750 B
export async function checkDatabaseClient(config) { try { // lazy loading sequelize package to enable peer dependency to be optional const databaseLib = await import("sequelize"); const { dbName, dbUser, dbPwd, dbDialect, dbPort, host } = config; // init sequelize const sequelize = new databaseLib.Sequelize(dbName || "postgres", dbUser || "", dbPwd, { dialect: dbDialect || "mysql", port: dbPort, host, logging: false, }); await sequelize.authenticate(); await sequelize.close(); return { status: true }; } catch (error) { return { status: false, error }; } } //# sourceMappingURL=database-service.js.map