You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
should we do checks on the provided port?
most of the times during deployment, the port number is fetched from an env file.
however, if the env var is not set (mostly just forgetting), Sys.getenv() returns an empty string. if passed to ambiorix, it is coerced into NA by as.integer().
this has bitten me a few times.
You're correct that better checks should be passed but we should also take that opportunity to rethink this a bit, namely in light of your discovery that it can be deployed on shiny server.
Perhaps the port argument could default to a convenience function that resolved the port somewhat intelligently, e.g.: port = get_port() which:
Check if environment variable is declared, if so uses that
explanation
should we do checks on the provided port?
most of the times during deployment, the port number is fetched from an env file.
however, if the env var is not set (mostly just forgetting),
Sys.getenv()
returns an empty string. if passed to ambiorix, it is coerced intoNA
byas.integer()
.this has bitten me a few times.
reprex
when you run the above, you get this on the console:
question
should we validate that the given port is indeed an integer and not
NA_integer_
? throw error maybe?hint
this should suffice:
this change can be made just before passing the port to
httpuv::startServer()
, hereThe text was updated successfully, but these errors were encountered: