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

Allow cleartext HTTP requests only in non-production builds #142

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

pkalita-lbl
Copy link
Collaborator

Fixes #119

Despite what this issue says, we didn't really need true separate environments as outlined in https://capacitorjs.com/docs/guides/environment-specific-configurations. What's written there would be necessary for controlling things like app IDs or custom URI schemes by environment. For simply enabling/disabling cleartext HTTP requests we just needed to set the cleartext value based on NODE_ENV.

I believe this only affects Android devices, so with VITE_NMDC_SERVER_API_URL=http://127.0.0.1:8000 (with a local nmdc-server instance running) the app should behave normally when running:

npm run sim.android

However it should not work when running:

NODE_ENV=production npm run sim.android

This is also a good reminder that we should explicitly set the NODE_ENV variable when we set up automated builds.

Copy link
Collaborator

@eecavanna eecavanna left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I consider this one of the benefits of using a .ts (or .js) file for configuration, rather than a .json file—we can include expressions (i.e. dynamic values) and comments.

@eecavanna eecavanna changed the title Allow cleartext requests only in non-production builds Allow cleartext HTTP requests only in non-production builds Aug 1, 2024
@pkalita-lbl pkalita-lbl merged commit 360e74e into main Aug 1, 2024
1 check passed
@pkalita-lbl pkalita-lbl deleted the issue-119-cleartext-config branch August 1, 2024 15:33
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.

Set up separate dev and prod environment Capacitor configurations
2 participants