Environmental variables created in Posit Connect Cloud don't persist if publish from Rstudio or refresh browser

Hello.

I'm a new user of Posit Connect Cloud and have found it very useful. I'm currently hosting a SMART on FHIR shiny app on Posit Connect Cloud.

However, the product would be more useful if environmental variables entered in the settings > variables section of my project on Posit Connect Cloud persisted when I republish changes to my project from Rstudio on my local machine. For my use case, I need to test and store different client_id and client_secret variables as environmental variables on Posit Connect Cloud and need to republish changes to Posit Connect Cloud that I make in my app in RStudio on my local machine. Yet, every time I republish a change to my project stored on Posit Connect Cloud it wipes out the stored environmental variables, and I need to re-enter long keys again.

Please consider enhancing Posit Connect Cloud by having environmental variables persist even when republish from Rstudio remotely.

Thanks! :slight_smile:

I agree that this element does not seem totally thought-through in Posit Connect Cloud. I have found that if you publish a .Renviron file with the app, it does read that and so can be used to store variables, though I think the documentation says that is not supposed to work. It's not a workable solution if you have to remember to manually update the environment variable settings every time you publish an app.

I ran into the same issue. My workaround was a custom code-only publishing request that omits the secrets field entirely, so Connect Cloud keeps the environment variables already saved there while updating the app code. I checked the secret records before and after publishing to confirm they were preserved.

I'm using rsconnect 1.8.0. This relies on internal APIs rather than a standard RStudio publishing option, but it has saved me from repeatedly entering variables.