Skip to content

Commit f37fc9c

Browse files
committed
Another try at fixing the failing tests
1 parent ecf2750 commit f37fc9c

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

dart/lib/src/environment_variables.dart

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,32 @@ void setEnvironmentVariables(SentryOptions options, EnvironmentVariables vars) {
2929
/// In an Flutter environment these can be set via
3030
/// `flutter build --dart-define=VARIABLE_NAME=VARIABLE_VALUE`.
3131
class EnvironmentVariables {
32+
static const _sentryEnvironment = 'SENTRY_ENVIRONMENT';
33+
static const _sentryDsn = 'SENTRY_DSN';
34+
static const _sentryRelease = 'SENTRY_RELEASE';
35+
static const _sentryDist = 'SENTRY_DSN';
36+
3237
/// `SENTRY_ENVIRONMENT`
3338
/// See [SentryOptions.environment]
34-
String? get environment => _readString('SENTRY_ENVIRONMENT');
39+
String? get environment => const bool.hasEnvironment(_sentryEnvironment)
40+
? const String.fromEnvironment(_sentryEnvironment)
41+
: null;
3542

3643
/// `SENTRY_DSN`
3744
/// See [SentryOptions.dsn]
38-
String? get dsn => _readString('SENTRY_DSN');
45+
String? get dsn => const bool.hasEnvironment(_sentryDsn)
46+
? const String.fromEnvironment(_sentryDsn)
47+
: null;
3948

4049
// `SENTRY_RELEASE`
4150
/// See [SentryOptions.release]
42-
String? get release => _readString('SENTRY_RELEASE');
51+
String? get release => const bool.hasEnvironment(_sentryRelease)
52+
? const String.fromEnvironment(_sentryRelease)
53+
: null;
4354

4455
/// `SENTRY_DIST`
4556
/// See [SentryOptions.dist]
46-
String? get dist => _readString('SENTRY_DIST');
47-
48-
String? _readString(String key) =>
49-
bool.fromEnvironment(key, defaultValue: false)
50-
? String.fromEnvironment(key)
51-
: null;
57+
String? get dist => const bool.hasEnvironment(_sentryDist)
58+
? const String.fromEnvironment(_sentryDist)
59+
: null;
5260
}

dart/lib/src/sentry.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ class Sentry {
5454

5555
static Future<void> _initDefaultValues(
5656
SentryOptions options, AppRunner? appRunner) async {
57-
var environment = options.platformChecker.environment;
58-
options.environment = options.environment ?? environment;
59-
6057
setEnvironmentVariables(options, EnvironmentVariables());
6158

6259
// Throws when running on the browser

0 commit comments

Comments
 (0)