mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +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')
 | 
			
		||||
  .action(getLocalScript('watchAdmin'));
 | 
			
		||||
 | 
			
		||||
program
 | 
			
		||||
  .command('configuration:dump')
 | 
			
		||||
  .option('-f, --file <file>', 'file to output to')
 | 
			
		||||
  .action(getLocalScript('configurationDump'));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Normalize help argument
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@ -53,6 +53,7 @@ class Strapi {
 | 
			
		||||
    this.admin = {};
 | 
			
		||||
    this.plugins = {};
 | 
			
		||||
    this.config = loadConfiguration(this.dir, opts);
 | 
			
		||||
    this.isLoaded = false;
 | 
			
		||||
 | 
			
		||||
    // internal services.
 | 
			
		||||
    this.fs = createStrapiFs(this);
 | 
			
		||||
@ -127,12 +128,9 @@ class Strapi {
 | 
			
		||||
 | 
			
		||||
  async start(cb) {
 | 
			
		||||
    try {
 | 
			
		||||
      await this.load();
 | 
			
		||||
 | 
			
		||||
      // Run bootstrap function.
 | 
			
		||||
      await this.runBootstrapFunctions();
 | 
			
		||||
      // Freeze object.
 | 
			
		||||
      await this.freeze();
 | 
			
		||||
      if (!this.isLoaded) {
 | 
			
		||||
        await this.load();
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      this.app.use(this.router.routes()).use(this.router.allowedMethods());
 | 
			
		||||
 | 
			
		||||
@ -236,6 +234,8 @@ class Strapi {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async load() {
 | 
			
		||||
    this.isLoaded = true;
 | 
			
		||||
 | 
			
		||||
    this.app.use(async (ctx, next) => {
 | 
			
		||||
      if (ctx.request.url === '/_health' && ctx.request.method === 'HEAD') {
 | 
			
		||||
        ctx.set('strapi', 'You are so French!');
 | 
			
		||||
@ -294,6 +294,9 @@ class Strapi {
 | 
			
		||||
    // Initialize hooks and middlewares.
 | 
			
		||||
    await initializeMiddlewares.call(this);
 | 
			
		||||
    await initializeHooks.call(this);
 | 
			
		||||
 | 
			
		||||
    await this.runBootstrapFunctions();
 | 
			
		||||
    await this.freeze();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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