-
Notifications
You must be signed in to change notification settings - Fork 281
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
Reload environment variables in development #997
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what to do with the logs. Right now it logs "Injecting variables to MiniOxygen: ....." every time the .env file is updated, which is not incorrect but might be too much output. Perhaps we could diff and only show the stuff that has changed.
I've bee going back and forth on where logs should go. Maybe it'd be easier if certain components were broken down even further into functions so that things could be more reuseable?
On save I think it'd be better to have something like "Change detected; reloading environment variables". I like the idea of a diff to shorten the output but might be more work than it's worth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How often will someone realistically be changing the .env
file? If I change it, I think it's nice to know that the server is getting those changes. So I think the feedback is good and I don't imagine it changing all that often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, keeping the same logs for now 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, right now this is downloading remote vars again on file save... Perhaps we should assume the remote variables don't change and we only read the local .env on file save?
I actually kind of love that it fetches them again but I wonder if that would be considered unexpected...
* Load env vars in parallel to initial build; Do not throw on env var errors * Reload env variables when project is linked to storefront * Wrap all calls in try-catch * Resolve variables in parallel and avoid crashing on fetch fail * Add .env to Remix watcher in templates * Changesets
Builds on top of https://github.com/Shopify/mini-oxygen/pull/458 to allow reloading environment variables when
.env
file changes.This also changes the behavior of the
combinedEnvironmentVariables
utility to avoid blocking the initial build.Not sure what to do with the logs. Right now it logs "Injecting variables to MiniOxygen: ....." every time the
.env
file is updated, which is not incorrect but might be too much output. Perhaps we could diff and only show the stuff that has changed.Also, right now this is downloading remote vars again on file save... Perhaps we should assume the remote variables don't change and we only read the local
.env
on file save?