|
12 | 12 | #' assets_ignore = '',
|
13 | 13 | #' serve_locally = TRUE,
|
14 | 14 | #' routes_pathname_prefix = '/',
|
15 |
| -#' requests_pathname_prefix = '/' |
| 15 | +#' requests_pathname_prefix = '/', |
| 16 | +#' external_scripts = NULL, |
| 17 | +#' external_stylesheets = NULL, |
| 18 | +#' suppress_callback_exceptions = FALSE |
16 | 19 | #' )
|
17 | 20 | #'
|
18 | 21 | #' @section Arguments:
|
|
88 | 91 | #' The latter may offer improved performance relative to callbacks written
|
89 | 92 | #' in R.
|
90 | 93 | #' }
|
| 94 | +#' \item{`callback_context()`}{ |
| 95 | +#' The `callback_context` method permits retrieving the inputs which triggered |
| 96 | +#' the firing of a given callback, and allows introspection of the input/state |
| 97 | +#' values given their names. It is only available from within a callback; |
| 98 | +#' attempting to use this method outside of a callback will result in a warning. |
| 99 | +#' } |
91 | 100 | #' \item{`run_server(host = Sys.getenv('DASH_HOST', "127.0.0.1"),
|
92 | 101 | #' port = Sys.getenv('DASH_PORT', 8050), block = TRUE, showcase = FALSE, ...)`}{
|
93 |
| -#' Launch the application. If provided, `host`/`port` set |
94 |
| -#' the `host`/`port` fields of the underlying [fiery::Fire] web |
95 |
| -#' server. The `block`/`showcase`/`...` arguments are passed along |
| 102 | +#' The `run_server` method has 13 formal arguments, several of which are optional: |
| 103 | +#' \describe{ |
| 104 | +#' \item{host}{Character. A string specifying a valid IPv4 address for the Fiery server, or `0.0.0.0` to listen on all addresses. Default is `127.0.0.1` Environment variable: `DASH_HOST`.} |
| 105 | +#' \item{port}{Integer. Specifies the port number on which the server should listen (default is `8050`). Environment variable: `DASH_PORT`.} |
| 106 | +#' \item{block}{Logical. Start the server while blocking console input? Default is `TRUE`.} |
| 107 | +#' \item{showcase}{Logical. Load the Dash application into the default web browser when server starts? Default is `FALSE`.} |
| 108 | +#' \item{use_viewer}{Logical. Load the Dash application into RStudio's viewer pane? Requires that `host` is either `127.0.0.1` or `localhost`, and that Dash application is started within RStudio; if `use_viewer = TRUE` and these conditions are not satsified, the user is warned and the app opens in the default browser instead. Default is `FALSE`.} |
| 109 | +#' \item{debug}{Logical. Enable/disable all the dev tools unless overridden by the arguments or environment variables. Default is `FALSE` when called via `run_server`. Environment variable: `DASH_DEBUG`.} |
| 110 | +#' \item{dev_tools_ui}{Logical. Show Dash's dev tools UI? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Environment variable: `DASH_UI`.} |
| 111 | +#' \item{dev_tools_hot_reload}{Logical. Activate hot reloading when app, assets, and component files change? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Requires that the Dash application is loaded using `source()`, so that `srcref` attributes are available for executed code. Environment variable: `DASH_HOT_RELOAD`.} |
| 112 | +#' \item{dev_tools_hot_reload_interval}{Numeric. Interval in seconds for the client to request the reload hash. Default is `3`. Environment variable: `DASH_HOT_RELOAD_INTERVAL`.} |
| 113 | +#' \item{dev_tools_hot_reload_watch_interval}{Numeric. Interval in seconds for the server to check asset and component folders for changes. Default `0.5`. Environment variable: `DASH_HOT_RELOAD_WATCH_INTERVAL`.} |
| 114 | +#' \item{dev_tools_props_check}{Logical. Validate the types and values of Dash component properties? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Environment variable: `DASH_PROPS_CHECK`.} |
| 115 | +#' \item{dev_tools_prune_errors}{Logical. Reduce tracebacks to just user code, stripping out Fiery and Dash pieces? Only available with debugging. `TRUE` by default, set to `FALSE` to see the complete traceback. Environment variable: `DASH_PRUNE_ERRORS`.} |
| 116 | +#' \item{dev_tools_silence_routes_logging}{Logical. Replace Fiery's default logger with `dashLogger` instead (will remove all routes logging)? Enabled with debugging by default because hot reload hash checks generate a lot of requests.} |
| 117 | +#' } |
| 118 | +#' Starts the Fiery server in local mode. If a parameter can be set by an environment variable, that is listed too. Values provided here take precedence over environment variables. |
| 119 | +#' Launch the application. If provided, `host`/`port` set the `host`/`port` fields of the underlying [fiery::Fire] web server. The `block`/`showcase`/`...` arguments are passed along |
96 | 120 | #' to the `ignite()` method of the [fiery::Fire] server.
|
97 | 121 | #' }
|
98 | 122 | #' }
|
@@ -1270,3 +1294,23 @@ validate_dependency <- function(layout_, dependency) {
|
1270 | 1294 |
|
1271 | 1295 | TRUE
|
1272 | 1296 | }
|
| 1297 | + |
| 1298 | +#' Retrieve Environment Variables |
| 1299 | +#' |
| 1300 | +#' This function queries an environment variable, returning the specified value when the result is undefined or an empty string. |
| 1301 | +#' |
| 1302 | +#' @param env_var Character. The name of the environment variable whose value will be retrieved. |
| 1303 | +#' @param value_if_missing Object. The value to be returned if the value of `env_var` is "", or the variable is undefined. |
| 1304 | +#' |
| 1305 | +#' @export |
| 1306 | +#' @examples |
| 1307 | +#' # returns NULL if "FOO" does not exist |
| 1308 | +#' getEnvVar("FOO", NULL) |
| 1309 | +getEnvVar <- function(env_var, value_if_missing=NULL) { |
| 1310 | + value <- Sys.getenv(env_var) |
| 1311 | + if (value == "") { |
| 1312 | + return(value_if_missing) |
| 1313 | + } else { |
| 1314 | + return(value) |
| 1315 | + } |
| 1316 | +} |
0 commit comments