mirror of
https://github.com/strapi/strapi.git
synced 2025-12-24 13:43:41 +00:00
improve error message + remove use of API_TOKEN_SALT
This commit is contained in:
parent
9fc63af260
commit
019007ba3e
@ -3,4 +3,7 @@ module.exports = ({ env }) => ({
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET', 'example-token'),
|
||||
},
|
||||
apiToken: {
|
||||
salt: env('API_TOKEN_SALT', 'example-salt'),
|
||||
},
|
||||
});
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const { env } = require('@strapi/utils');
|
||||
|
||||
module.exports = {
|
||||
salt: env('API_TOKEN_SALT'),
|
||||
};
|
||||
@ -6,5 +6,4 @@ module.exports = {
|
||||
forgotPassword: {
|
||||
emailTemplate: forgotPasswordTemplate,
|
||||
},
|
||||
apiToken: require('./api-token'),
|
||||
};
|
||||
|
||||
@ -78,7 +78,7 @@ const checkSaltIsDefined = () => {
|
||||
if (!strapi.config.get('admin.apiToken.salt')) {
|
||||
const secretExample = crypto.randomBytes(16).toString('base64');
|
||||
throw new Error(
|
||||
`Missing admin.apiToken.salt. Please set admin.apiToken.salt in config/admin.js (ex: ${secretExample})`
|
||||
`Missing apiToken.salt. Please set apiToken.salt in config/admin.js (ex: ${secretExample})`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -56,7 +56,7 @@ const checkSecretIsDefined = () => {
|
||||
if (strapi.config.serveAdminPanel && !strapi.config.get('admin.auth.secret')) {
|
||||
const secretExample = crypto.randomBytes(16).toString('base64');
|
||||
throw new Error(
|
||||
`Missing admin.auth.secret. Please set admin.auth.secret in config/admin.js (ex: ${secretExample})`
|
||||
`Missing auth.secret. Please set auth.secret in config/admin.js (ex: ${secretExample})`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -33,7 +33,7 @@ module.exports = async ({ strapi }) => {
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
throw new Error(
|
||||
`[Users & Permissions] Missing jwtSecret. Please set jwtSecret in your config or set environment variable JWT_SECRET (ex: ${jwtSecret}).`
|
||||
`[Users & Permissions] Missing jwtSecret. Please, in config/plugins.js, set config.jwtSecret for the users-permissions plugin or set environment variable JWT_SECRET (ex: ${jwtSecret}).`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user