Starts one multilingual Shiny application backed by SQLite. Open
base_url for participants and append /?mod=1 for the moderator.
Configuration is resolved at invocation, never at package load time.
Usage
run_app(
db_path = Sys.getenv("DB_PATH", default_db_path()),
mod_pin = Sys.getenv("MOD_PIN", "635"),
base_url = Sys.getenv("BASE_URL", "http://localhost:3838"),
port = Sys.getenv("PORT", "3838"),
host = "127.0.0.1",
poll_ms = 2500
)Arguments
- db_path
Main SQLite file path. Defaults to
DB_PATH, thenbrainwriting.sqlitein the package's user data directory,tools::R_user_dir("brainwritR", "data"). Use an absolute path for a long-running service.- mod_pin
Moderator PIN. Defaults to
MOD_PIN, then"635". The demonstration PIN is accepted only with a loopback host and URL.- base_url
Public participant URL used in the QR code. Defaults to
BASE_URL, then"http://localhost:3838". Must not contain credentials, a fragment, or the reserved query parameterss,mod, andview.- port
Listening port. Defaults to
PORT, then3838.- host
Listening address, default
"127.0.0.1". Set"0.0.0.0"explicitly to accept network connections, with a private moderator PIN.- poll_ms
Database polling interval in milliseconds, default
2500.
Value
Invisibly, the value returned by shiny::runApp() when the app stops.
Details
The main database holds the standard session behind base_url and the
catalogue of all further sessions. Each further session is a separate SQLite
file in a sessions folder next to the main database, with its own address
(?s=<code>) and QR code. Moderators create, open, restart, archive and
delete sessions in the overview at ?mod=1&view=sessions.
Use exactly one R process per data folder. No replicas or horizontal scaling are supported. A round advances on the next connected client's poll; with no clients connected it advances when someone reconnects. Moderator logins are kept in server memory, so a restart asks for the PIN again.
Examples
if (interactive()) {
run_app()
}