Support IO workspace specific .env configurations in AB apps
Expected Behaviour
When working and deploying AB apps to different IO workspaces, different environment specific configurations are required as input for the actions. The environment specific configs are stored in the .env file, however there is only one file, so manual changes are required to the file each time. This is not only cumbersome but also error prone, i.e. when forgetting to update the .env file and deploying the wrong config. Some custom scripted approaches exists for this common requirement, but a proper product solution should be provided.
To support workspace specific configurations the following structure and functionality is proposed:
-
.env: configuration for the currently selected workspace (viaaio app use) - `.env.
: multiple env files for all workspaces of the IO project, e.g. 'develop', 'develop2', 'stage', 'prod', etc. which contain the actual configuration for each workspace -
env.global: optionally a file which contains global env configuration properties valid for all workspaces - When a workspace is switched, e.g. via
aio app use, then the.envfile content is overwritten with the content of the.env.<workspace-name>file - Optionally (if implemented) the content of the
.env.globalis merged into the new.envfile - This relatively simple functionality could be implemented in the
aio app useplugin command, as it already modifies other configuration files anyway (.aioandapp.config.yaml)
Actual Behaviour
Currently only one .env file exists for all workspaces which prevents proper workspace specific configurations
Platform and Version
- @adobe/aio-cli 9.1.0
- @adobe/aio-cli-plugin-app 10.0.2
Sample Code that illustrates the problem
On a brief look into the code, this could be a place to add this feature: https://github.com/adobe/aio-cli-plugin-app/blob/70b9a426c7972c20cced304254d4c84c73fcd78a/src/lib/import.js#L606
JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-1860