Fix auto set config if doent exist

This commit is contained in:
Jim Laurie 2017-12-12 15:13:27 +01:00
parent 455ff3ed68
commit 832617159d
3 changed files with 6 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -16,9 +16,12 @@ const uuid = require('uuid/v4');
module.exports = cb => {
if (!_.get(strapi.plugins['users-permissions'], 'config.jwtSecret')) {
try {
const jwtSecret = uuid();
fs.writeFileSync(path.join(strapi.config.appPath, 'plugins', 'users-permissions', 'config', 'jwt.json'), JSON.stringify({
jwtSecret: uuid()
jwtSecret
}, null, 2), 'utf8');
_.set(strapi.plugins['users-permissions'], 'config.jwtSecret', jwtSecret);
} catch(err) {
strapi.log.error(err);
}

View File

@ -226,6 +226,7 @@ module.exports = {
try {
fs.writeFileSync(roleConfigPath, stringify({ roles: data }, null, 2), 'utf8');
_.set(strapi.plugins['users-permissions'], 'config.roles', data);
} catch(err) {
strapi.log.error(err);
}