Add AIO_DEV env flag to detect running local#151
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an environment variable flag to detect when the application is running in a local development (dev) mode as opposed to in production.
- Adds the AIO_DEV environment variable in run-dev.js to indicate a development environment.
- Includes comments to clarify that this flag is only set during local development runs.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 641 642 +1
Branches 132 132
=========================================
+ Hits 641 642 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This pull request adds an environment flag (AIO_DEV) to detect when the application is running in development mode via "aio app dev".
- Introduces new environment variable AIO_DEV with a truthy value
- Adds inline comments explaining the purpose of the flag
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new environment flag, AIO_DEV, to distinguish between local development and runtime environments.
- The change injects the AIO_DEV environment variable with a truthy string value ("true") when running locally with aio app dev.
- The change is implemented in the src/lib/run-dev.js file to enable environment detection during development.
| // set up environment variables for aio | ||
| // this can be read as truthy, it will not exist in Runtime | ||
| // ex. console.log('AIO_DEV ', process.env.AIO_DEV ? 'dev' : 'prod') | ||
| process.env.AIO_DEV = 'true' |
There was a problem hiding this comment.
Consider checking if process.env.AIO_DEV is already set before overwriting it. This helps preserve any external overrides and makes the intent of the flag clearer.
| process.env.AIO_DEV = 'true' | |
| if (process.env.AIO_DEV === undefined) { | |
| process.env.AIO_DEV = 'true' | |
| } |
Description
Inject env var to detect if we were run by
aio app devthis can be read as truthy, it will not exist in Runtime (ie.
aio app run)Related Issue
adobe/aio-cli#753
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: