Skip to content

Commit

Permalink
[+] Apimap - Send engine name, engine version, framework name, framew…
Browse files Browse the repository at this point in the history
…ork version, database version and orm name in apimap meta
  • Loading branch information
root-io committed Mar 1, 2019
1 parent b11c2a0 commit 381e526
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Change Log

## [Unreleased]
### Added
- Apimap - Send engine name, engine version, framework name, framework version, database version and orm name in apimap meta.

## RELEASE 3.0.0-beta.0 - 2019-01-28
### Added
Expand Down
29 changes: 22 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,37 @@ exports.init = function(opts) {
opts.connections = [opts.mongoose];
}

exports.getLianaName = function () {
exports.getLianaName = function getLianaName() {
return 'forest-express-mongoose';
};

exports.getLianaVersion = function () {
exports.getLianaVersion = function getLianaVersion() {
var lianaVersion = require('./package.json').version.match(REGEX_VERSION);
if (lianaVersion && lianaVersion[0]) {
return lianaVersion[0];
}
};

exports.getOrmVersion = function () {
exports.getDatabaseType = function getDatabaseType() {
return 'MongoDB';
};

exports.getDatabaseVersion = function getDatabaseVersion() {
if (!opts.mongoose) { return null; }

opts.mongoose.db.command({ buildInfo: 1 }, function (error, info) {
if (error || !info) {
return null;
}
return info.version || null;
});
};

exports.getOrmName = function getOrmName() {
return 'mongoose';
};

exports.getOrmVersion = function getOrmVersion() {
if (!opts.mongoose) { return null; }

try {
Expand All @@ -42,10 +61,6 @@ exports.init = function(opts) {
}
};

exports.getDatabaseType = function () {
return 'MongoDB';
};

exports.SchemaAdapter = require('./adapters/mongoose');

exports.getModels = function () {
Expand Down

0 comments on commit 381e526

Please sign in to comment.