'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. Not sure if relevant but I'm publishing the app on RStudo Connect.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source