Skip to content
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

Force environment variables when running on iOS #5899

Conversation

buggmagnet
Copy link
Contributor

@buggmagnet buggmagnet commented Mar 5, 2024

This PR tricks rust into believing environment variables have been set properly when running on iOS.

With this, we can then add the --features flag when building crates for iOS to allow overriding the API when running in a staging environment for example.


This change is Reviewable

@buggmagnet buggmagnet added the iOS Issues related to iOS label Mar 5, 2024
@buggmagnet buggmagnet requested a review from dlon March 5, 2024 13:58
@buggmagnet buggmagnet self-assigned this Mar 5, 2024
Copy link

linear bot commented Mar 5, 2024

Copy link
Member

@dlon dlon left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @buggmagnet)


mullvad-api/src/ffi/mod.rs line 71 at r1 (raw file):

        })?;

        std::env::set_var(crate::env::API_HOST_VAR, &api_hostname);

The arguments to new will be ignored for any clients but the first one, since the environment variables are only used to lazily initialize a global static (API). If it's not worth fixing, can you add a doc comment pointing this out?

Copy link
Member

@dlon dlon left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@buggmagnet buggmagnet force-pushed the simulate-overriden-environment-variable-when-running-on-ios-ios-541 branch from 032ed38 to 2b94c70 Compare March 7, 2024 07:33
@buggmagnet buggmagnet merged commit ea865a0 into main Mar 7, 2024
38 of 39 checks passed
@buggmagnet buggmagnet deleted the simulate-overriden-environment-variable-when-running-on-ios-ios-541 branch March 7, 2024 07:33
Copy link

github-actions bot commented Mar 7, 2024

🚨 End to end tests failed. Please check the failed workflow run.

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

Successfully merging this pull request may close these issues.

2 participants