MetaMask / MetaMask/metamask-mobile
Use default value for required env variable
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
in the build.sh we have `METAMASK_BUILD_TYPE` and `METAMASK_ENVIRONMENT` env variables that are mandatory. The error message displayed when not set indicates default values. But these defaults are not automatically used when no variable is set. Also in order to make the error message more useful, we should provide a way to load the variables. `source .js.env` may be required.
### Scenario
- GIVEN I want to run the default main local build
- AND I haven't defined the `METAMASK_BUILD_TYPE` and `METAMASK_ENVIRONMENT` variables
- AND build script says it had defaults
- Then I expect the build script not to force me to define the `METAMASK_BUILD_TYPE` and `METAMASK_ENVIRONMENT` variables but use the defaults as indicated in the error message.
### Design
_No response_
### Technical Details
- update [error messages in build.sh](https://github.com/MetaMask/metamask-mobile/blob/c1922b51bd152f8d9c81a11c536db80adbcd9e2a/scripts/build.sh#L555-L567C3)
- add defaults if variables are not defined: `main` for `METAMASK_BUILD_TYPE` and `local` for `METAMASK_ENVIRONMENT`
### Threat Modeling Framework
_No response_
### Acceptance Criteria
_No response_
### Stakeholder review needed before the work gets merged
- [X] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)
### References
See https://github.com/MetaMask/metamask-mobile/blob/c1922b51bd152f8d9c81a11c536db80adbcd9e2a/scripts/build.sh#L555-L567C3
Contributor guide
Research direction
Start in scripts/build.sh, especially the error-message section around lines 555-567, and inspect how METAMASK_BUILD_TYPE and METAMASK_ENVIRONMENT are read when unset. Verify the default main/local build path and update the messages or loading behavior so the documented defaults are actually used; confirm the script no longer requires those variables for that scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100