Disabled Studio connection in production environment

This commit is contained in:
Aurélien Georget 2015-10-29 17:09:09 +01:00
parent 260c300168
commit 67de1b791f

View File

@ -43,7 +43,7 @@ module.exports = function (strapi) {
const _self = this;
let firstConnectionAttempt = true;
if (_.isPlainObject(strapi.config.studio) && !_.isEmpty(strapi.config.studio) && strapi.config.studio.enabled === true) {
if (_.isPlainObject(strapi.config.studio) && !_.isEmpty(strapi.config.studio) && strapi.config.studio.enabled === true && strapi.config.environment === 'development') {
const manager = io.Manager(strapi.config.studio.url, {
reconnectionDelay: 2000,
reconnectionDelayMax: 5000,
@ -114,20 +114,7 @@ module.exports = function (strapi) {
strapi.log.info('Connected with the Studio server.');
});
} else {
socket.emit('testEncryption', {
appId: strapi.config.studio.appId,
env: strapi.config.environment,
encrypted: strapi.rsa.encrypt({
secretKey: strapi.config.studio.secretKey,
data: 'ok'
})
}, function (err) {
if (err) {
strapi.log.warn(err);
}
strapi.log.info('Connected with the Studio server.');
});
strapi.log.warn('The use of the Studio is restricted to development environment.');
}
}
});