Skip to content

Commit

Permalink
feat: dumpConfig add appInfo (#4917)
Browse files Browse the repository at this point in the history
  • Loading branch information
mansonchor authored Apr 1, 2022
1 parent 4e53091 commit c1313f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/egg.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class EggApplication extends EggCore {
ignoreList = [];
}

const json = extend(true, {}, { config: this.config, plugins: this.loader.allPlugins });
const json = extend(true, {}, { config: this.config, plugins: this.loader.allPlugins, appInfo: this.loader.appInfo });
utils.convertObject(json, ignoreList);
return {
config: json,
Expand Down
5 changes: 4 additions & 1 deletion test/lib/egg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ describe('test/lib/egg.test.js', () => {
});
after(() => app.close());

it('should dump config and plugins', () => {
it('should dump configplugins、appInfo', () => {
let json = require(path.join(baseDir, 'run/agent_config.json'));
assert(/\d+\.\d+\.\d+/.test(json.plugins.onerror.version));
assert(json.config.name === 'demo');
assert(json.config.tips === 'hello egg');
assert(json.appInfo.name === 'demo');
json = require(path.join(baseDir, 'run/application_config.json'));
checkApp(json);

Expand All @@ -38,6 +39,8 @@ describe('test/lib/egg.test.js', () => {
assert(json.config.name === 'demo');
// should dump dynamic config
assert(json.config.tips === 'hello egg started');

assert(json.appInfo);
}
});

Expand Down

1 comment on commit c1313f5

@vercel
Copy link

@vercel vercel bot commented on c1313f5 Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.