Running shiny app with global file that has a different name

I have one folder with 2 Shiny apps inside - they share ui.R and server.R but their global.R files differ. How to run Shiny app with global2.R file instead of global.R? I was trying

shiny::shinyApp(ui = source("ui.R")$value, server = source("server.R")$value, onStart = source("global2.R"))

but it doesn't work. We are using RStudio Connect to to deploy the apps.

suggestion 1)
dont have 2 shiny apps in 1 folder - change the way you work
suggestion 2)
make a single simpler global.R that can determine what app is being run, and conditionally source for a relevant file

Thanks! Can you explain how can global.R determine what app is being run?

well, you have told me that aside from you wanting different globals.R, the apps would be otherwise identical/indistinguishable, so I guess its a red herring of an option, as we lack a criteria for telling them apart aside from which global is run for it, which leaves us in a circularity. To me this strengthens the argument, for having two apps, in two folder, when you intend for one app to do one thing, and another app to do another thing.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.