[BREAKING] feat: support loadConfig asynchronous#11
Open
Conversation
7514364 to
a0066ea
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #11 +/- ##
==========================================
Coverage ? 100.00%
==========================================
Files ? 6
Lines ? 33
Branches ? 0
==========================================
Hits ? 33
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. |
31caaba to
42327b4
Compare
42327b4 to
b33ff7a
Compare
troyeagle
reviewed
Jun 24, 2019
| config = Object.assign({}, config, { urllib: app.httpclient }); | ||
| if (is.function(config.loadConfig)) { | ||
| const result = config.loadConfig(config, app); | ||
| config = is.promise(result) ? (await result) : result; |
There was a problem hiding this comment.
这样直接赋值的话 client 的配置会不会覆盖 default 啊(盲猜
测试用例里好像也没体现
Author
There was a problem hiding this comment.
There was a problem hiding this comment.
这样的话 default 中的异步函数由于延迟执行,会覆盖 client 里面已经设置好的重复字段;对于 client 和 default 都需要异步函数的情形还支持不了。
https://gist.github.com/troyeagle/b10774eff060cc6c6d1ed51ba8d842ec 可能是一种解决方法。总之用异步函数设定的值会打破原先 default 和 client 的加载顺序。求教在这种情形下应该怎么考虑设计
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
npm testpassesAffected core subsystem(s)
Description of change
oss 的 ak/sk 可能配置的是加密的,启动的时候可能需要先调用 api 进行解密