golem
golem copied to clipboard
shinyserver_file does not include options for shiny
I needed to increase my upload limit and I manage to do that in run_dev.R file, by updating the command: options(golem.app.prod = FALSE,shiny.maxRequestSize=40*1024^2) # I setup a 40 mb limit.
Everything worked on my computer, as I was running the app by running the entire run_dev.R file
However, when I uploaded my shiny app to my company server, I discovered that the app.R file (generated by the command add_shinyserver_file() in 03_dev.R file) does not contain the options above. Off course, I edited by hand app.R file to include my desired options and now it works fine.
I think it would be nice that the command add_shinyserver_file() generates an app.R file that contains all the options setup in run_dev.R file
Thank you.
Hey,
Thanks a lot for your feedback! :)
I'm kind of torn on this idea. The run_dev.R script is by definition something for development purpose, while the app.R generated is for production setting 🤔
So the general idea is to be able to set two different contexts for your application: the local one, and the development one. For example I have a lot of app that take parameters, and these parameters are defined differently if you are in run_dev.R or in app.R, because you're not in the same environment.
I suppose you already know that, but it might be interesting to define this option inside the run_app() function, instead of in the scripts that launch the application?
Another solution might be to have some kind of shiny-options.R file that is sourced when launching the application, so that you're sure all these options are always there.
Hello Colin
To be honest I am on my first golem app – actually rewriting an old app with golem framework and I have not yet used different parameters on developmentmode versus production mode. It might well be a good idea to define this optioninside run_app() as you suggested.
My user perspective is this: I know I setup my shiny.optionsomewhere, but still it does not seem to work when I deploy to production.Thankfully, golem framework is so clear that you immediately spot the missing link,so it might not be an issue for many users as it was not a big issue for meneither.
So probably it would be a good idea to wait and see if othersinquire this kind of issue and then decide accordingly. I decided to let youknow about my experience as upload limit files can potentially impact manyshiny developers.
On Tuesday, September 15, 2020, 04:50:00 PM GMT+3, Colin Fay <[email protected]> wrote:
Hey,
Thanks a lot for your feedback!
I'm kind of torn on this idea. The run_dev.R script is by definition something for development purpose, while the app.R generated is for production setting.
So the general idea is to be able to set two different contexts for your application: the local one, and the development one. For example I have a lot of app that take parameters, and these parameters are defined differently if you are in run_dev.R or in app.R, because you're not in the same environment.
I suppose you already know that, but it might be interesting to define this option inside the run_app() function, instead of in the scripts that launch the application?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Ok so I now have a clearer opinion on this one.
As far as I see it, run_dev should only contain dev related things, and the app.R file that is built should be used for prod.
If you want to have options that are set for both, you can use an .Rprofile file :)
Best, Colin