-
Notifications
You must be signed in to change notification settings - Fork 35
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: implement RuntimeConfig #144
Conversation
Get RuntimeConfig through RuntimeConfigUtil It contains - baseDir - env - name
6842b45
to
a1e988e
Compare
baseDir: string; | ||
} | ||
|
||
export class RuntimeConfigUtil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里应该只是一个定义
class RuntimeConfig {
name: string;
env: string;
baseDir: string;
}
在具体的 runtime 中把这个类构造出来。
这样就能解决多个实例的问题了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所以这里还是类型注入的模式?用法就是
import type { RuntimeConfig } from '@alipay/tegg-common-util';
@SingletonProto()
class Example {
@Inject()
runtimeConfig: RuntimeConfig;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
plugin/tegg/app.ts
Outdated
@@ -20,6 +21,11 @@ export default class App { | |||
} | |||
|
|||
configWillLoad() { | |||
RuntimeConfigUtil.setRuntimeConfig({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里也改成一下就好了
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #144 +/- ##
=======================================
Coverage 93.76% 93.77%
=======================================
Files 227 227
Lines 4731 4738 +7
Branches 509 509
=======================================
+ Hits 4436 4443 +7
Misses 295 295
☔ View full report in Codecov by Sentry. |
LGTM |
RuntimeConfig can be injected in tegg and standalone
It contains
Checklist
npm test
passesAffected core subsystem(s)
Description of change