Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: inject moduleConfig read from tegg-config app.moduleConfigs config #169

Merged
merged 2 commits into from
Dec 9, 2023

Conversation

nightink
Copy link
Contributor

@nightink nightink commented Dec 5, 2023

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
  • @eggjs/tegg-plugin
  • @eggjs/tegg-config
Description of change

module.yml/json 存放一些敏感配置 例如 db password(kms:encodepassword....),我们需要在应用启动前将其配置解密还原成明文数据字段

目前看到的注入点 app.moduleConfigs,所以需要 inject moduleConfig 优先读取 app.moduleConfigs 数据对象,确保服务在注入的时候拿到的是解密后配置

@nightink nightink requested review from killagu and fengmk2 December 5, 2023 07:39
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (81d3f74) 92.48% compared to head (f874998) 92.48%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #169   +/-   ##
=======================================
  Coverage   92.48%   92.48%           
=======================================
  Files         235      235           
  Lines        5017     5019    +2     
  Branches      538      538           
=======================================
+ Hits         4640     4642    +2     
  Misses        377      377           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fengmk2
Copy link
Member

fengmk2 commented Dec 5, 2023

@killagu 看看,配置加载这块我不太熟悉

@nightink nightink force-pushed the feat/config-patch-1 branch from 813a8e9 to 8e1f05a Compare December 5, 2023 08:17
Copy link
Contributor

@killagu killagu left a comment

Choose a reason for hiding this comment

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

LGTM

@fengmk2 fengmk2 merged commit 2d984ef into eggjs:master Dec 9, 2023
17 checks passed
@fengmk2
Copy link
Member

fengmk2 commented Dec 9, 2023

@killagu 发布卡住了
image

@@ -37,4 +37,18 @@ describe('test/ModuleConfig.test.ts', () => {
});
});
});

it('should work with overwrite', async () => {
mm(app.moduleConfigs.simple.config, 'features', { dynamic: { foo: 'bar', bar: 'overwrite foo' } });
Copy link
Member

Choose a reason for hiding this comment

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

@nightink 这个 mock 干扰比较大,是不是删除掉?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

哦哦 这个忘记删了 这个 case 里没用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants