Skip to content

Fix: Read all environment variables in sentry #375

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

Merged
merged 19 commits into from
Mar 29, 2021
Merged

Conversation

ueman
Copy link
Collaborator

@ueman ueman commented Mar 22, 2021

📜 Description

Environment variables are now read in sentry.
This also includes #376

💡 Motivation and Context

#306

💚 How did you test it?

I've written new tests.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

@marandaneto
Copy link
Contributor

@ueman is PR title a typo? sentry_flutter, we should read from sentry package, so it'd work for non mobile apps

@ueman ueman changed the title Fix: Read all environment variables in sentry_flutter Fix: Read all environment variables in sentry_dart Mar 22, 2021
@ueman
Copy link
Collaborator Author

ueman commented Mar 22, 2021

@ueman is PR title a typo? sentry_flutter, we should read from sentry package, so it'd work for non mobile apps

Yep, that was a typo

@ueman ueman marked this pull request as ready for review March 22, 2021 08:45
@ueman ueman force-pushed the fix/environment-variables branch from c1bfc93 to ecf2750 Compare March 22, 2021 09:33
@ueman
Copy link
Collaborator Author

ueman commented Mar 22, 2021

I've opened an issue for failing Flutter beta builds here: #377

@ueman ueman changed the title Fix: Read all environment variables in sentry_dart Fix: Read all environment variables in sentry Mar 22, 2021
Co-authored-by: Manoel Aranda Neto <[email protected]>
@codecov-io
Copy link

codecov-io commented Mar 22, 2021

Codecov Report

Merging #375 (b9169f3) into main (0d775f1) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #375      +/-   ##
==========================================
+ Coverage   90.19%   90.25%   +0.05%     
==========================================
  Files          51       52       +1     
  Lines        1642     1652      +10     
==========================================
+ Hits         1481     1491      +10     
  Misses        161      161              
Impacted Files Coverage Δ
dart/lib/src/sentry_options.dart 81.25% <ø> (ø)
dart/lib/src/environment_variables.dart 100.00% <100.00%> (ø)
dart/lib/src/platform_checker.dart 75.00% <100.00%> (+15.00%) ⬆️
dart/lib/src/sentry.dart 85.71% <100.00%> (-0.96%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d775f1...b9169f3. Read the comment docs.

@ueman ueman changed the title Fix: Read all environment variables in sentry Fix: Read all environment variables in sentry and #375 Mar 23, 2021
@ueman ueman changed the title Fix: Read all environment variables in sentry and #375 Fix: Read all environment variables in sentry and #376 Mar 23, 2021
@bruno-garcia bruno-garcia changed the title Fix: Read all environment variables in sentry and #376 Fix: Read all environment variables in sentry Mar 25, 2021
@bruno-garcia
Copy link
Member

Removed the #376 from the title

@ueman
Copy link
Collaborator Author

ueman commented Mar 29, 2021

@marandaneto I fixed the last missing bits. Please let me know if it is now good to go.

@@ -1,3 +1,5 @@
import 'sentry_options.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we move defaultEnvironment to EnvironmentVariables instead

@@ -17,4 +19,18 @@ class PlatformChecker {
bool isProfileMode() {
return const bool.fromEnvironment('dart.vm.profile', defaultValue: false);
}

/// This can be set as [SentryOptions.environment]
String get environment {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a method instead? quite a few conditions to be just a property, maybe we move hardcoded values to EnvironmentVariables instead

expect(options.dist, 'foo');
});

test('No options are set', () async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe let's improve the test name, something like, SentryOptions are overridden by environment

@@ -3,10 +3,12 @@ import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:package_info_plus/package_info_plus.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge main into this branch to not show the diff of non related stuff

@marandaneto
Copy link
Contributor

@marandaneto I fixed the last missing bits. Please let me know if it is now good to go.

made a few small suggestions but other than that LGTM

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ueman ueman merged commit de0a2ce into main Mar 29, 2021
@ueman ueman deleted the fix/environment-variables branch March 29, 2021 09:01
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

Successfully merging this pull request may close these issues.

4 participants