{{retoolContext.configVars}} not returning configuration variables

Hey team :wave:

I'm using the cloud hosted solution and I've got some configuration variables set up. They work fine when I reference them from resources with {{ environment.variables.NAME }}. The documentation says I can reference them in apps and queries using {{ retoolContext.configVars.YOUR_VAR_NAME }}, but there does not seem to be any values returned in {{ retoolContext.configVars }}:

CleanShot 2023-08-03 at 11.49.59@2x

Has anyone come across this before?

Hi Mick, can you confirm the config vars you are trying to use in your app are not marked as secret?

Secret config vars can only be used in resource configs, but non-secret vars can be accessed anywhere.

Thanks for the reply, @Iva_Milo! I can confirm that the config var I want to use is not marked as a secret. Most of the vars are marked as secret but the one I'm trying to use in the app is not. :slight_smile:

Hi @cosmick - thanks for posting about this and confirming on @Iva_Milo's question! This is a known bug that the eng team is actively working on a fix for. We'll update you as soon as it's fixed (aiming for next week's Wednesday release to Cloud)!

I also see there's a possible temporary workaround: switching environments in the app editor, which should load up the config vars. If that doesn't work though, the fix should be in place relatively soon. :slightly_smiling_face:

1 Like

Hey @cosmick - as an update, the fix for this bug will go out with this week's Cloud release :slightly_smiling_face:

1 Like

It looks like you still can't use {{ retoolContext.configVars }} in queries though?
I see that they now work in code but not in queries. Is there maybe another way to reference config vars in query definitions?

@Alexis_Odysseos thanks for asking about this -- I tried this out and I can reference configVars in a postgreSQL query, in a JS query, and in the variables of a GraphQL query for example (below):

What type of query are you aiming to reference config vars from? Some screenshots of where you're trying to reference or more detail on the type of resource, and use case will help me pinpoint more context (pun not intended) on this for you!

A post was split to a new topic: Allow {{retoolContext.configVars}} to be accessible in query library

@Alexis_Odysseos got it, thank you for surfacing this! I've split this out into a new Feature Request post so we can track the request to allow accessing {{ retoolContext.configVars }} in the QueryLibrary. We can keep you posted there if this gets picked up by the eng team and implemented, and also track others' interest in it there.

@cosmick fyi circling back to confirm that the issue where {{retoolContext.configVars}} was not returning configuration variables when referenced from apps/queries was already fixed in Cloud and has also been back-ported in self-hosted v3.4.12 :rocket: Thanks again for posting about this!

1 Like