Tychobra / polished

Authentication and Administration for Shiny apps
https://polished.tech
Other
234 stars 36 forks source link

new function `set_config_env()` #32

Closed merlinoa closed 5 years ago

merlinoa commented 5 years ago

@phoward38 @RichardHHill please work on this one together. Make sure to document the function and update the package docs.

This functions should check session$clientData$hostname to determine if the app is running locally or if it is deployed somewhere (e.g. shinyapps.io). If it is running locally it should set the the config environment to "default" using Sys.setenv(R_CONFIG_ACTIVE = "default"). If it is deployed it should set it to production using Sys.setenv(R_CONFIG_ACTIVE = "production").

We will use this app in "global.R", so we no longer need to set this manually.

Have the app take 1 argument override that can be used to override whether the config env is set to "default" or "production". The only valid values for this argument should be "default", "production", or NULL. It should be NULL by default.

RichardHHill commented 5 years ago

Added with 20267c72bb83350ab5e67dd32042d78f2de5f005

merlinoa commented 5 years ago

The Shiny session can't be accessed from "global.R", so this function won't work as intended in its current format. Is there another way to determine the run environment of the Shiny app?

phoward38 commented 5 years ago

Completed with 26cf65c277658dcd5d3f64a95f5781c7b4d5502d. Updated documentation with 3339de9dffd6208b1a20a4e4f09d2eb0b7cd3bf3.

merlinoa commented 5 years ago

looks good to me