Category: Datasources
Resource links
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Access Environment Variables

Issue

I want to access environment variables that I define in the values.yml file from the AppSmith application, but it's currently not possible as envs are not accessible in Javascript apps today. I need this to differentiate between multiple environments (dev, prod) and apply specific restrictions based on the current environment. These features are currently on the AppSmith roadmap, and I've added my use case on GitHub to help prioritize them.

Resolution

The solution to accessing environment variables defined in the values.yml or docker.env file (depending on the deployment method used) from Appsmith applications is currently not possible as environment variables are not accessible via Javascript. 

However, on our Business Edition, it is possible to isolate the testing and production datasources by using the Datasource Environments feature.

Appsmith also has a feature request to allow reading environment variables for datasources and encourages users to add a comment with their use case to this GitHub issue, as it would help prioritize it.