Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
Is there a way to programmatically differentiate between SDK environments?

Hello all,

I currently have two versions of a Q2 SDK extension, one pointing to our FI's Q2 test environment and one pointing to our production environment. This is because each extension contains an API call with a different endpoint using a different cert depending on environment.

Is there a way to tell at runtime which environment the user is in, so that I can combine these two extensions into one using an envrionmental conditional?

Thanks!
Brian C.

Votes Newest

Answers


If you want to programatically determine which environment your extension is running in, the following code will work:

import configuration.settings as settings
env = settings.DEPLOY_ENV #This will be "DEV", "STG", or "PROD"

For endpoints, you can set the URL and other endpoint details in Wedge Address Configs, and they will be available to the extension at runtime. Then during deployment you can request how you want the configurations to be set.

For certificates loaded from vault, you will be able to load the cert from the same place and we can place different certs in Vault that will correspond to the environment you're in. If you have VAULT_SCOPED_READ = True set in your configuration/settings.py file, the scope will be at the particular environment level, not just Staging vs. Prod, so for instance if you had multiple Staging environments you could choose whether the scope defaults to an individual Staging environment or the entire Staging network.

https://docs.q2developer.com/docs/api_references/q2_sdk/core/vault.html#q2_sdk.core.vault.Q2Vault.get_certificate

Posted 5 years ago
Mark Ostroth
309 × 5 Administrator
-1

This makes sense. Thanks for the info, Mark!

— Brian Chambers   5 years ago
232 Views
1 Answer
5 years ago
5 years ago
Tags