Passing environment variable to an app in shiny server

Hi,

I am currently trying to use rocker/shiny to deploy an application. I use also the config :package: to ease configuration in deployement. R_CONFIG_ACTIVE env variable is defined in the Docke file but is not found by the shiny app.

It seems that an environment variable cannot be pass easily to a running app. There is an old discussion on that : https://groups.google.com/forum/#!topic/shiny-discuss/nNs0kztwdWo

Is this still the case ? Is there a configuration that could help ?
Is there something that can be done outside of R code ? I mean that config :package: helps configure behavior per environment ouside of the R code. I would have thought to do something like that in my Dockerfile, or at run docker run -e R_CONFIG_ACTIVE= ...

A workaround is to not use rocker/shiny as it seems to be a limitation of shiny server (for security reason)

Currently I use this

env | grep R_CONFIG_ACTIVE > /home/shiny/.Renviron
chown shiny.shiny /home/shiny/.Renviron

to pass the env variable to the shiny user that runs the app.

it is working but I wonder if there is another way to do it.

3 Likes

A post was merged into an existing topic: How to pass R environment data variables into shiny app to deployinto shinypps.io