- Notifications
You must be signed in to change notification settings - Fork928
DNM: example runtime config usage#14561
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Closed
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
5a24f7a
to9069a48
CompareSign up for freeto 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.
Uh oh!
There was an error while loading.Please reload this page.
Demonstration of how#14470 could be used in practice.
This PR allows for the runtime reconfiguration of the notification webhook endpoint.
In reality, what we'dactually want it for this value to be configurable on a per-organization level, but the plumbing to get the org details into the
Dispatch
function complicates the demonstration.NOTE: in
codersdk/deployment.go
you'll notice at the bottom that we're iterating over all fields and callingInitialize(opt.Env)
:This is because we need to assign a
name
to each wrapped field. This name is used to identify the field in the database, and this is the simplest approach@Emyrk and I could come up with. We need some stable identity for each field, and the field'sEnv
value is stable.NOTE: I've protected
func (DeploymentValues) Options()
with async.OnceFunc
because this method gets called in several places and it's both inefficient and dangerous to run this code several times; once is enough.TestRuntimeEndpointChange
demonstrates how it all comes together. Besides the changes incoderd/notifications/dispatch/webhook.go
, this is mostly boilerplate.