mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Merge pull request #13958 from strapi/fix/clean-config-new-projects
Clean config files for generated projects
This commit is contained in:
commit
07b0ec2ba5
@ -16,7 +16,6 @@ const mergeTemplate = require('./utils/merge-template.js');
|
||||
|
||||
const packageJSON = require('./resources/json/common/package.json');
|
||||
const createDatabaseConfig = require('./resources/templates/database.js');
|
||||
const createAdminConfig = require('./resources/templates/admin-config.js');
|
||||
const createEnvFile = require('./resources/templates/env.js');
|
||||
|
||||
module.exports = async function createProject(scope, { client, connection, dependencies }) {
|
||||
@ -108,11 +107,6 @@ module.exports = async function createProject(scope, { client, connection, depen
|
||||
})
|
||||
);
|
||||
|
||||
// create config/server.js
|
||||
await fse.writeFile(
|
||||
join(rootPath, `config/admin.${language}`),
|
||||
createAdminConfig({ useTypescript })
|
||||
);
|
||||
await trackUsage({ event: 'didCopyConfigurationFiles', scope });
|
||||
|
||||
// merge template files if a template is specified
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=1337
|
||||
APP_KEYS="toBeModified1,toBeModified2"
|
||||
APP_KEYS="toBeModified1,toBeModified2"
|
||||
API_TOKEN_SALT=tobemodified
|
||||
ADMIN_JWT_SECRET=tobemodified
|
||||
JWT_SECRET=tobemodified
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
export default ({ env }) => ({
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET', '<%= adminJwtToken %>'),
|
||||
secret: env('ADMIN_JWT_SECRET'),
|
||||
},
|
||||
apiToken: {
|
||||
salt: env('API_TOKEN_SALT'),
|
||||
@ -1,20 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const _ = require('lodash');
|
||||
|
||||
module.exports = ({ useTypescript }) => {
|
||||
// resolve ts or js version depending on project type
|
||||
const language = useTypescript ? 'ts' : 'js';
|
||||
|
||||
const tmpl = fs.readFileSync(path.join(__dirname, language, `admin-config.template`));
|
||||
const compile = _.template(tmpl);
|
||||
|
||||
return compile({
|
||||
adminJwtToken: crypto.randomBytes(16).toString('hex'),
|
||||
useTypescript,
|
||||
});
|
||||
};
|
||||
@ -1,8 +0,0 @@
|
||||
module.exports = ({ env }) => ({
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET', '<%= adminJwtToken %>'),
|
||||
},
|
||||
apiToken: {
|
||||
salt: env('API_TOKEN_SALT'),
|
||||
},
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user