aio-cli icon indicating copy to clipboard operation
aio-cli copied to clipboard

Support IO workspace specific .env configurations in AB apps

Open elagun opened this issue 3 years ago • 1 comments

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 (via aio 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 .env file content is overwritten with the content of the .env.<workspace-name> file
  • Optionally (if implemented) the content of the .env.global is merged into the new .env file
  • This relatively simple functionality could be implemented in the aio app use plugin command, as it already modifies other configuration files anyway (.aio and app.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

elagun avatar Oct 28 '22 12:10 elagun

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-1860

aiojbot avatar Oct 28 '22 22:10 aiojbot