Leiste mit Community-Erfolgen erweitern.

Get ready! An upgraded Experience League Community experience is coming in January.

Mark Solution

Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.

GELÖST

Access to env file

Avatar

Community Advisor

is there an easy way to access the key/values from the env file within the app or within the actions? or do I need to install a node module that handles the env files?

Themen

Anhand von Themen werden Community-Inhalte kategorisiert und Sie können so relevanten Inhalt besser finden.

1 Akzeptierte Lösung

Avatar

Korrekte Antwort von
Employee

Hi @Urs_Boller , the .env file is to defined the environment variables at build time. If you want to use them in the actions, you need to pass those variables to the actions via default parameters. To do the mapping, in manifest.yml, for each action there is an "inputs" section. You could simply map all the variables you want for the action there. For example: in .env you have `CAMPAIGN_TENANT="my-tenant"`, then in manifest add `campaignTenant: $CAMPAIGN_TENANT` to the respective action, finally in the action get it with `const tenant = params.campaignTenant`.

Reference docs: https://github.com/AdobeDocs/project-firefly/blob/master/getting_started/first_app.md#5-anatomy-of-a...

Lösung in ursprünglichem Beitrag anzeigen

2 Antworten

Avatar

Korrekte Antwort von
Employee

Hi @Urs_Boller , the .env file is to defined the environment variables at build time. If you want to use them in the actions, you need to pass those variables to the actions via default parameters. To do the mapping, in manifest.yml, for each action there is an "inputs" section. You could simply map all the variables you want for the action there. For example: in .env you have `CAMPAIGN_TENANT="my-tenant"`, then in manifest add `campaignTenant: $CAMPAIGN_TENANT` to the respective action, finally in the action get it with `const tenant = params.campaignTenant`.

Reference docs: https://github.com/AdobeDocs/project-firefly/blob/master/getting_started/first_app.md#5-anatomy-of-a...

Avatar

Community Advisor
@duypnguyen thanks a lot, really easy to use and works perfect!