How can I use environment variables in my apps ?
I have an identifier of some of our resources which I want to be able to display in our apps when they're opened.
I tried using %RETOOL_EXPOSED_MY_CONFIG% in apps, but this notion isn't recognized
Nor is {{MY_CONFIG}} or {{RETOOL_EXPOSED_MY_CONFIG}}
Happy to help here! I believe these would only be available on the resource setup page and not in the app itself. Let me know if you have any questions!
Hey @nishant.vashisth — would you mind telling me a little more about these dynamic configs? Are you looking for data to persist per user or per app? You may be able to use global JS (link to our docs on this here) for this.
This config is a mongo db generated identifier of one of the database resources.
Since we have a retool instance per environment, the mongo db identifier is different, and I'd like to have access to that identifier when running queries to be there as an extra filter to the mongo query.
For you, yes, I did end up using organization level java script to inject the value in functions.
i.e.
window.myIdentifier(() =>
return 1234567890;
);
However, if this was a secret identifier, then it would've been super difficult for me to achieve this.
Is there a way to provide a secret identifier the same way ?
Hey @nishant.vashisth — so after asking around here, it sounds like this is not currently possible in Retool. I don't believe there is a way to include a secret value in the body of a query. Would you mind posting this as a feature request on the community so that other users who are interested can chime in on this?
Hi @Chris-Thompson,
That's unfortunately, for now, I'm using organization level javascript since it's not transferred to instances automatically via git sync.