-
Notifications
You must be signed in to change notification settings - Fork 38
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
Globus app configurable environment #1001
Globus app configurable environment #1001
Conversation
Discussed this PR offline w/ Kurt. Ended up modifying it in a couple ways:
sandbox_app = UserApp("my-app", client_id=..., config=GlobusAppConfig(environment="sandbox"))
# Valid - instantiates a sandbox flows client
FlowsClient(app=sandbox_app)
# Also valid - a little redundant but nothing wrong here
FlowsClient(app=sandbox_app, environment="sandbox")
# Invalid - Raises GlobusSDKUsageError
FlowsClient(app=sandbox_app, environment="preview") and the (probably) more contentious case # Environment is inferred to default "production" environment
production_app = UserApp("my-app", client_id=...)
# Invalid - app inferred "production" but client specified "sandbox"
FlowsClient(app=production_app, environment="sandbox") |
Good catch @kurtmckee!
I think I slightly prefer this over the hierarchy, as I feel like I'm more likely to miss a mismatch than need to run a script that touches multiple environments since all our current tooling assumes one environment per run. Don't think it matters too much one way or the other though since this will probably be entirely internal |
In the case that you do need to touch multiple environments, you still can! You'll just need to make two GlobusApps explicitly. |
Co-authored-by: Kurt McKee <[email protected]>
Added
GlobusAppConfig.environment
.If omitted, this value is set by looking up the
GLOBUS_SDK_ENVIRONMENT
variable, defaulting to"production"
if unset.Notable changes:
(A) A client's environment inference heirarchy is now:
GlobusAppConfig
or is read from theGLOBUS_SDK_ENVIRONMENT
environment variable.GLOBUS_SDK_ENVIRONMENT
(B) GlobusApp default token storage is now prefixed with the environment name for lower envs.
So for example, in the following snippet
app1
's tokens would be stored at~/.globus/app/my-cool-app/tokens.json
app2
's tokens would be stored at~/.globus/app/my-cool-app/sandbox-tokens.json
📚 Documentation preview 📚: https://globus-sdk-python--1001.org.readthedocs.build/en/1001/