server_config {servr} | R Documentation |
Server configurations
Description
The server functions in this package are configured through this function.
Usage
server_config(
dir = ".",
host = getOption("servr.host", "127.0.0.1"),
port,
browser,
daemon,
interval = getOption("servr.interval", 1),
baseurl = "",
initpath = "",
hosturl = identity,
auth = getOption("servr.auth"),
verbose = TRUE
)
Arguments
dir |
The root directory to serve. |
host |
A string that is a valid IPv4 address that is owned by this
server, or |
port |
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 |
browser |
Whether to launch the default web browser. By default, it is
|
daemon |
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 |
interval |
The time interval used to check if an HTML page needs to be rebuilt (by default, it is checked every second). |
baseurl |
The base URL (the full URL will be
|
initpath |
The initial path in the URL (e.g. you can open a specific HTML file initially). |
hosturl |
A function that takes the host address and returns a character
string to be used in the URL, e.g., |
auth |
A list of the form |
verbose |
Whether to print messages when launching the server. |
Value
A list of configuration information of the form list(host,
port, start_server = function(app) {}, ...)
.
Examples
# an example of authentication
servr::httd(auth = list(scheme = "Basic", creds = servr::auth_basic("john", "pa$s!")))