-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
96 lines (72 loc) · 2.69 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: "BOAST Utilities"
author: EducationShinyAppTeam
date: February 26, 2021
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
eval = FALSE,
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
Used to provide reusable [components](https://shiny.rstudio.com/articles/html-tags.html), [gadgets](https://shiny.rstudio.com/articles/gadgets.html), and [modules](https://shiny.rstudio.com/articles/modules.html) for the [BOAST](https://github.com/EducationShinyAppTeam/BOAST) project.
## Installation
You can install this version of boastUtils from [GitHub](https://github.com/) with:
```{r}
devtools::install_github("EducationShinyAppTeam/boastUtils")
```
**Troubleshooting:**
- [Error: (converted from warning) package 'xyz' was built under R version x.y.z](https://github.com/r-lib/remotes/issues/403#issuecomment-513891775)
Create an [issue](https://github.com/EducationShinyAppTeam/boastUtils/issues) if the problem is not solved by one of the above.
## Creating an App
One way to accomplish serving a more standardized codebase was to provide a wrapper for the default [shinyApp](https://shiny.rstudio.com/reference/shiny/latest/shinyApp.html) function. Instead of including the `shiny` package, include `boastUtils` and write your app as normal. Be sure to replace `shinyApp` with `boastApp`.
**Example app.R**
```{r}
library(boastUtils)
ui <- fluidPage(
# ... ui definitions ...
)
server <- function(input, output, session){
# ... server logic ...
}
boastApp(ui = ui, server = server)
```
## Configuration
We currently have one config option available which disables xAPI logging.
**Example app.R**
```{r}
boastApp(ui = ui, server = server, config = list(log = FALSE))
```
## Additional Configuration
To connect with services such as CouchDB for persistent storage, place details in an environment variable using `appDir/inst/.Renviron`. This information is then pulled into `boastUtils/inst/config.yml` on app startup. These details are meant to be kept private and should not be pushed to GitHub.
**See also:**
- `boastUtils:::.getConfig()`
- https://cran.r-project.org/web/packages/httr/vignettes/api-packages.html#authentication
**.Renviron**
```{txt}
DB_USER=<DATABASE_USERNAME>
DB_PASSWORD=<DATABASE_PASSWORD>
R_CONFIG_ACTIVE=rsconnect
```
**config.yml**
```{yml}
default:
database:
host: 'localhost'
transport: 'https'
port: NULL
user: 'root'
pwd: 'root'
rsconnect:
database:
host: 'dev.stat.vmhost.psu.edu/couch'
transport: 'https'
port: NULL
user: !expr Sys.getenv("DB_USER")
pwd: !expr Sys.getenv("DB_PASSWORD")
```