-
Notifications
You must be signed in to change notification settings - Fork 621
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
Add support for Service Bindings to Worker uploads #947
Add support for Service Bindings to Worker uploads #947
Conversation
merging with public docs as the service team has confirmed this is a stable API and we are awaiting some documentation revamps. |
@@ -268,6 +270,33 @@ func (b WorkerSecretTextBinding) serialize(bindingName string) (workerBindingMet | |||
}, nil, nil | |||
} | |||
|
|||
type WorkerServiceBinding struct { | |||
Service string | |||
Environment *string |
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.
Why pass as pointer here?
} | ||
|
||
if b.Environment != nil { | ||
meta["environment"] = *b.Environment |
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.
Oh, the pass as pointer required because this may be nil?
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.
Right, if you pass nil or empty string the binding is set to the default environment.
without public docs 👀 Interesting re: Environment can be nil. A good example why docs are helpful. |
@ObsidianMinor In your case for handling Environment-is-nil, does it make sense given the proposal at cloudflare/workers-sdk#382 to use |
This adds support for Service Bindings to Worker uploads, needed so we can support Service Bindings in our Terraform provider.
Types of changes
What sort of change does your code introduce/modify?
Checklist: