-
-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
I tried to submit this as a PR, but I got a 403. Nothing in the CONTRIBUTING documentation was helpful. I'll just drop the diff here for someone else to pick up and land.
Describe the bug
In order to use env vars across different environments in a Supabase FDW, you have to reference the Vault secret by name. This adds the ability to specify api_key_name in the Hubspot similar to the Stripe FDW.
To Reproduce
diff --git a/wasm-wrappers/fdw/hubspot_fdw/src/lib.rs b/wasm-wrappers/fdw/hubspot_fdw/src/lib.rs
index 101976b..239212a 100644
--- a/wasm-wrappers/fdw/hubspot_fdw/src/lib.rs
+++ b/wasm-wrappers/fdw/hubspot_fdw/src/lib.rs
@@ -219,12 +219,15 @@ impl Guest for HubspotFdw {
// get foreign server options
let opts = ctx.get_options(OptionsType::Server);
this.base_url = opts.require_or("api_url", "https://api.hubapi.com/crm/v3");
- let api_key = match opts.get("api_key") {
- Some(key) => key,
- None => {
- let key_id = opts.require("api_key_id")?;
- utils::get_vault_secret(&key_id).unwrap_or_default()
- }
+
+ // Get API key in order of preference: api_key -> api_key_id -> api_key_name
+ let api_key = if let Some(key) = opts.get("api_key") {
+ key
+ } else if let Some(id) = opts.get("api_key_id") {
+ utils::get_vault_secret(&id).unwrap_or_default()
+ } else {
+ let key_name = opts.require("api_key_name")?;
+ utils::get_vault_secret_by_name(&key_name).unwrap_or_default()
};
// HubSpot API authentication
Expected behavior
I should be able to specify api_key_name to the Hubspot FDW server.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: [e.g. macOS, Windows]
- Browser (if applies) [e.g. chrome, safari]
- Version of supabase-js: [e.g. 6.0.2]
- Version of Node.js: [e.g. 10.10.0]
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working