nx10 / httpgd

Asynchronous http server graphics device for R.
https://nx10.github.io/httpgd
GNU General Public License v2.0
379 stars 19 forks source link

Persistent startup port and options #12

Closed nx10 closed 3 years ago

nx10 commented 4 years ago

[...] For users who would really prefer to not type in ports and/or tokens each time, you might consider adding options, where the defaults are sane (allowing them to set personal prefs in ~/.Rprofile):

httpgd <-
  function(host = getOption("httpgd.host", "127.0.0.1"),
           port = getOption("httpgd.port", 0L),
           width = 720,
           height = 576,
           bg = "white",
           pointsize = 12,
           system_fonts = list(),
           user_fonts = list(),
           recording = TRUE,
           cors = FALSE,
           token = getOption("httpgd.token", TRUE)) {

In related packages, I've found it useful when the "random port" remains constant for the current R session. It's not hard to do: generate a random port and token in .onLoad and/or you can use a local({ ... function(...) {... } }) trick for a function (likely httpgd::httpgd).

[...]

Originally posted by @r2evans in https://github.com/nx10/httpgd/issues/5#issuecomment-637157337

nx10 commented 3 years ago

Fixed e4e6cc67e21a5e296e8b626ea29c61f4921768c2

r2evans commented 3 years ago

... though I think it was actually fixed with b97eedad5fd039046d8b96c0e4f3682c958b3649 :-)