mirror of
https://github.com/strapi/strapi.git
synced 2025-11-13 08:38:09 +00:00
Init
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
2b3d94d747
commit
34026fd88c
@ -205,6 +205,11 @@ program
|
|||||||
.description('Starts the admin dev server')
|
.description('Starts the admin dev server')
|
||||||
.action(getLocalScript('watchAdmin'));
|
.action(getLocalScript('watchAdmin'));
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('configuration:dump')
|
||||||
|
.option('-f, --file <file>', 'file to output to')
|
||||||
|
.action(getLocalScript('configurationDump'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize help argument
|
* Normalize help argument
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -53,6 +53,7 @@ class Strapi {
|
|||||||
this.admin = {};
|
this.admin = {};
|
||||||
this.plugins = {};
|
this.plugins = {};
|
||||||
this.config = loadConfiguration(this.dir, opts);
|
this.config = loadConfiguration(this.dir, opts);
|
||||||
|
this.isLoaded = false;
|
||||||
|
|
||||||
// internal services.
|
// internal services.
|
||||||
this.fs = createStrapiFs(this);
|
this.fs = createStrapiFs(this);
|
||||||
@ -127,12 +128,9 @@ class Strapi {
|
|||||||
|
|
||||||
async start(cb) {
|
async start(cb) {
|
||||||
try {
|
try {
|
||||||
await this.load();
|
if (!this.isLoaded) {
|
||||||
|
await this.load();
|
||||||
// Run bootstrap function.
|
}
|
||||||
await this.runBootstrapFunctions();
|
|
||||||
// Freeze object.
|
|
||||||
await this.freeze();
|
|
||||||
|
|
||||||
this.app.use(this.router.routes()).use(this.router.allowedMethods());
|
this.app.use(this.router.routes()).use(this.router.allowedMethods());
|
||||||
|
|
||||||
@ -236,6 +234,8 @@ class Strapi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
this.isLoaded = true;
|
||||||
|
|
||||||
this.app.use(async (ctx, next) => {
|
this.app.use(async (ctx, next) => {
|
||||||
if (ctx.request.url === '/_health' && ctx.request.method === 'HEAD') {
|
if (ctx.request.url === '/_health' && ctx.request.method === 'HEAD') {
|
||||||
ctx.set('strapi', 'You are so French!');
|
ctx.set('strapi', 'You are so French!');
|
||||||
@ -294,6 +294,9 @@ class Strapi {
|
|||||||
// Initialize hooks and middlewares.
|
// Initialize hooks and middlewares.
|
||||||
await initializeMiddlewares.call(this);
|
await initializeMiddlewares.call(this);
|
||||||
await initializeHooks.call(this);
|
await initializeHooks.call(this);
|
||||||
|
|
||||||
|
await this.runBootstrapFunctions();
|
||||||
|
await this.freeze();
|
||||||
}
|
}
|
||||||
|
|
||||||
async startWebhooks() {
|
async startWebhooks() {
|
||||||
|
|||||||
25
packages/strapi/lib/commands/configurationDump.js
Normal file
25
packages/strapi/lib/commands/configurationDump.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const { logger } = require('strapi-utils');
|
||||||
|
const loadConfiguration = require('../core/app-configuration');
|
||||||
|
const strapi = require('../index');
|
||||||
|
|
||||||
|
module.exports = async function({ file }) {
|
||||||
|
const output = file ? fs.createWriteStream(file) : process.stdout;
|
||||||
|
|
||||||
|
output.write('this is a test');
|
||||||
|
|
||||||
|
const app = strapi();
|
||||||
|
|
||||||
|
await app.load();
|
||||||
|
|
||||||
|
const confs = await app.query('core_store').find({
|
||||||
|
key_contains: 'plugin',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(confs);
|
||||||
|
|
||||||
|
output.write('\n');
|
||||||
|
output.end();
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user