Skip to content

Read SENTRY_RELEASE and other env vars in the dart package #306

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

Closed
bruno-garcia opened this issue Feb 22, 2021 · 3 comments
Closed

Read SENTRY_RELEASE and other env vars in the dart package #306

bruno-garcia opened this issue Feb 22, 2021 · 3 comments
Assignees

Comments

@bruno-garcia
Copy link
Member

Discovering release via env var is also useful in the core dart package to be used by Dart VM projects.

@marandaneto
Copy link
Contributor

marandaneto commented Mar 22, 2021

@ueman this issue is about

// for non-mobile builds, we read the release and dist from the
// system variables (SENTRY_RELEASE and SENTRY_DIST).
options.release = const bool.hasEnvironment('SENTRY_RELEASE')
? const String.fromEnvironment('SENTRY_RELEASE')
: options.release;
options.dist = const bool.hasEnvironment('SENTRY_DIST')
? const String.fromEnvironment('SENTRY_DIST')
: options.dist;

ideally, for non Android/iOS, this should work for the Dart package too, maybe moving this around

https://github.com/getsentry/sentry-dart/blob/main/dart/lib/src/sentry.dart#L64-L72

@ueman
Copy link
Collaborator

ueman commented Mar 22, 2021

Thanks, I already figured that out, though.

One question I have is the order of precedence.
Is it environment variables over SentryOptions over values read from package_info or device?

@marandaneto
Copy link
Contributor

see here https://docs.sentry.io/platforms/dart/configuration/options/

it depends on the property tbh, eg
options.dsn has precedence over SENTRY_DSN

SENTRY_ENVIRONMENT has precedence over options.environment

package_info has precedence over SENTRY_RELEASE, SENTRY_RELEASE has precedence over options.release (this is tricky as package_info is an integration and executed only later)

dist isn't documented but I guess it'd be similar to environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants