server_config {servr}R Documentation

Server configurations


The server functions in this package are configured through this function.


server_config(dir = ".", host = getOption("", ""), port, browser, 
    daemon, interval = getOption("servr.interval", 1), baseurl = "", initpath = "", 
    verbose = TRUE)



The root directory to serve.


A string that is a valid IPv4 address that is owned by this server, or "" to listen on all IP addresses.


The TCP port number. If it is not explicitly set, the default value will be looked up in this order: First, the command line argument of the form -pNNNN (N is a digit from 0 to 9). If it was passed to R when R was started, NNNN will be used as the port number. Second, the environment variable R_SERVR_PORT. Third, the global option servr.port (e.g., options(servr.port = 4322)). If none of these command-line arguments, variables, or options were set, the default port will be 4321. If this port is not available, a random available port will be used.


Whether to launch the default web browser. By default, it is TRUE if the R session is interactive(), or when a command line argument -b was passed to R (see commandArgs()). N.B. the RStudio viewer is used as the web browser if available.


Whether to launch a daemonized server (the server does not block the current R session) or a blocking server. By default, it is the global option getOption('servr.daemon') (e.g., you can set options(servr.daemon = TRUE)); if this option was not set, daemon = TRUE if a command line argument -d was passed to R (through Rscript), or the server is running in an interactive R session.


The time interval used to check if an HTML page needs to be rebuilt (by default, it is checked every second).


The base URL (the full URL will be http://host:port/baseurl).


The initial path in the URL (e.g. you can open a specific HTML file initially).


Whether to print messages when launching the server.


A list of configuration information of the form list(host, port, start_server = function(app) {}, ...).

[Package servr version 0.15.1 Index]