Commit 7d7642eb authored by Félix Hamel's avatar Félix Hamel

1.7.25-beta3

* Will now check if user info are available before showing them
parent 90db1533
......@@ -98,13 +98,15 @@ CMBF.prototype.callHook = function(key, params, defaultImpl) {
if (hook) {
this.log.trace("Registered hook %s will be used", key);
return P.method(hook).call(this, params, defaultImpl);
} else if (defaultImpl) {
}
else if (defaultImpl) {
this.log.trace(
"No registered hook %s was found but a default implementation was provided",
key
);
return P.method(defaultImpl)(params);
} else {
}
else {
this.log.trace("No hook found, let's continue");
return P.resolve(params);
}
......@@ -165,7 +167,8 @@ CMBF.prototype.waitFor = function(deps, options) {
function printDependencies(deps) {
if (_.isEmpty(deps)) {
return "0 plugins";
} else {
}
else {
return _.reduce(deps, function(item) {
return item + ", ";
});
......@@ -202,7 +205,8 @@ CMBF.prototype.installPlugin = P.method(function(plugin, options) {
});
this.plugins.push(entry);
} else {
}
else {
_this.log.trace(
"Plugin %s was already pre-registered. Updating implementation and version only",
path
......@@ -292,17 +296,22 @@ CMBF.prototype.launch = P.method(function(pluginOpts) {
server.on("request", function(request) {
if (request.method !== "options") {
server.log(["request"], {
user: {
username: request.auth.credentials.profile.username,
email: request.auth.credentials.profile.email,
token: request.headers.authorization
},
let LOG = {
headers: request.headers,
method: request.method,
url: request.url.path,
payload: request.payload
});
};
if (request.auth.credentials && request.auth.credentials.profile) {
LOG["user"] = {
username: request.auth.credentials.profile.username,
email: request.auth.credentials.profile.email,
token: request.headers.authorization
};
}
server.log(["request"], LOG);
}
});
......@@ -317,17 +326,13 @@ CMBF.prototype.launch = P.method(function(pluginOpts) {
DATA = {
"message": "Stripped by logger, please execute again to view the complete response"
};
} else {
}
else {
DATA = request.response.source.data;
}
}
server.log(["response"], {
user: {
username: request.auth.credentials.profile.username,
email: request.auth.credentials.profile.email,
token: request.headers.authorization
},
let LOG = {
headers: request.headers,
method: request.method,
url: request.url.path,
......@@ -338,7 +343,16 @@ CMBF.prototype.launch = P.method(function(pluginOpts) {
message: request.response.source.message,
statusCode: request.response.source.statusCode
}
});
};
if (request.auth.credentials && request.auth.credentials.profile) {
LOG["user"] = {
username: request.auth.credentials.profile.username,
email: request.auth.credentials.profile.email,
token: request.headers.authorization
};
}
server.log(["response"], LOG);
}
});
......@@ -455,7 +469,8 @@ CMBF.prototype.launch = P.method(function(pluginOpts) {
};
connections.push(apiOpts);
connections.push(adminOpts);
} else {
}
else {
apiOpts.labels.push("admin");
connections.push(apiOpts);
}
......
{
"name": "cmbf-core",
"version": "1.7.25-beta2",
"version": "1.7.25-beta3",
"description": "Covistra Mobile-Backend Framework Core Module",
"main": "index.js",
"scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment