feat(cli): load env based on foundry profile
closes https://github.com/latticexyz/mud/issues/3565
I am not in love with this approach because it adds an implicit --profile flag to all our commands, but there's not really another way to do this because
- we need to load the env files before importing commands (due to how debug and other libs use env on import)
- to avoid unnecessarily overriding env vars (like ones passed directly into the command), we have to load env files in order of most-specific to least-specific (which means we need to know the value of the
--profileflag ahead of time)
I also don't love mucking with process.argv but we only use it in this file and dotenv already mucks with process.env in the same way, so maybe it's fine.
⚠️ No Changeset found
Latest commit: a7b066aab71a6812983380001aa7b528664019b2
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR