-
Notifications
You must be signed in to change notification settings - Fork 838
[common][dynamicconfig] Move dynamic config to fx Module #6828
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
[common][dynamicconfig] Move dynamic config to fx Module #6828
Conversation
5a2cd09
to
2247310
Compare
@@ -192,8 +192,8 @@ func getCadencePackageDir() (string, error) { | |||
if err != nil { | |||
panic(err) | |||
} | |||
cadenceIndex := strings.LastIndex(cadencePackageDir, "/cadence/") | |||
cadencePackageDir = cadencePackageDir[:cadenceIndex+len("/cadence/")] | |||
cadenceIndex := strings.LastIndex(cadencePackageDir, "cadence/") |
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.
This broke my setup with a folder named /my-cadence/.
I've copied the solution from nosql version
2247310
to
137dca2
Compare
p.Logger.Info("initialising NOP dynamic config client") | ||
res = dynamicconfig.NewNopClient() | ||
} else if err != nil { | ||
p.Logger.Error("creating dynamic config client failed, using no-op config client instead", tag.Error(err)) |
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.
Error cases silently switching to no-op config doesn't sound right. I know that's also the current behavior but we should consider failing startup if there's a misconfiguration for dynamicconfigs.
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.
That's a good point, but I'm unsure how safe it is. It's something to consider for v2: a stricter startup to ensure no missing dependencies.
What changed?
I introduce dynamicconfigfx.Module to inject dynamic config to fx application.
Why?
This is one of the few common dependencies that exist outside of the resource and can be initialized separately.
Also, it ensures a single instance that provides consistent reads of dynamic config if there are multiple services running in one binary.
How did you test it?
Unit tests
Potential risks
Release notes
Documentation Changes