{{retoolContext.configVars}} not returning configuration variables when embedding

I am using environment variable is my apps to store environment data. When I try to embed the application, the values disappear or are not set.

Do I need to do something special to make configVars work with embedded applications?

Hi @victory,

Configuration variables ("config vars"), are not automatically available when embedding an application in Retool. To make config vars work with embedded applications, you'll need to explicitly pass them along during the embedding process. Here's how to do it:

1. Identify the Configuration Variables:
Determine the specific configuration variables that you need to use within the embedded application. These variables should be declared and defined in the Retool environment where the embedding is taking place.

2. Prepare the Embedded Application:
Before embedding the application, make sure it's ready to receive the configuration variables. This may involve adding code or markup to handle the variables and integrate them into the application's logic.

3. Pass Configuration Variables During Embedding:
When embedding the application, utilize the embedConfigVars property to pass the required configuration variables. This property accepts an object where each key represents a variable name and the corresponding value represents the variable value.

Here is an example:

retool.embedApp('my-app', {
  embedConfigVars: {
    myConfigVar1: 'value1',
    myConfigVar2: 'value2'
  }
});

By following these steps, you can effectively utilize configuration variables within embedded applications in Retool. Remember to ensure that the configuration variables are properly defined in the embedding environment and are passed along during the embedding process.

Hope this helps!

:grinning:

Patrick