Expand my Community achievements bar.

Environment specific configuration for Adobe IO runtime project

Avatar

Level 2

Requirement : We need to create and read environment specific configurations on Adobe IO project i.e WCS Commerce API urls and different namespace based on different environment(Dev, Prod) 

We followed steps provided in document 

https://www.adobe.io/apis/experienceplatform/runtime/docs.html#!adobedocs/adobeio-runtime/master/get...

Steps:

1- Created .env file in workspace.

2- Provided AIO_RUNTIME_APIHOST , AIO_RUNTIME_AUTH and AIO_RUNTIME_NAMESPACE

3- Deployed code base .

Issue 1: Unable to pick credentials provided in .env file.

Issue 2: How to read environment specific variables in node.js code base . 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Employee

Hi @Sharma_Shruti 

Are you configuring the wsk cli or the aio cli?

The .env file only applies if you are configuring the Adobe I/O CLI. After you create the `.env` file within the current working directory, update it with your Runtime credential and save the file. When you are in this directory, and type in `aio runtime property get`, all the values should be automatically picked up and shown here. You can proceed to execute any `aio runtime` commands, including deployment commands. 

Alternatively, if you already have a `.wskprops` file in your root directory, the Adobe I/O CLI picks that up automatically as well.

Hope this helps.

Sarah

Avatar

Level 2

Hi Sarah,

Thank you for the input regarding the .env file. Can you please help us with issue #2. Below is the problem statement for the same.

How can we detect the Adobe IO namespace through node js code at runtime, and based on that call different endpoints (REST based commerce API). 

 

Thanks

Avatar

Employee

On issue #1 Sarah Xu already answered. On issue #2, can you give us more details about what you are trying to do?