Database version in features (#5627)

* adding database.version in the serverInfo (only MongoDB, it gives undefined when using Postgres)

* . correction of old 'features' tests
. adding engine and database in the StorageAdapter interface and implementations

* . version retrieval done in performInitialization
. PostgreSQL version

* performInitialization now returns a Promise
This commit is contained in:
Olivier Allouch
2019-06-03 23:58:21 +02:00
committed by Diamond Lewis
parent 266d6328a3
commit 7fc0d45b89
5 changed files with 61 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ export class FeaturesRouter extends PromiseRouter {
'/serverInfo',
middleware.promiseEnforceMasterKeyAccess,
req => {
const { config } = req;
const features = {
globalConfig: {
create: true,
@@ -33,9 +34,9 @@ export class FeaturesRouter extends PromiseRouter {
from: true,
},
push: {
immediatePush: req.config.hasPushSupport,
scheduledPush: req.config.hasPushScheduledSupport,
storedPushData: req.config.hasPushSupport,
immediatePush: config.hasPushSupport,
scheduledPush: config.hasPushScheduledSupport,
storedPushData: config.hasPushSupport,
pushAudiences: true,
localization: true,
},
@@ -51,10 +52,15 @@ export class FeaturesRouter extends PromiseRouter {
},
};
const dbAdapter = config.database.adapter;
return {
response: {
features: features,
parseServerVersion: version,
database: {
engine: dbAdapter.engine,
version: dbAdapter.databaseVersion,
},
},
};
}