-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_app.R
More file actions
33 lines (27 loc) · 831 Bytes
/
deploy_app.R
File metadata and controls
33 lines (27 loc) · 831 Bytes
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
app_dir <- normalizePath(getwd(), winslash = "/", mustWork = TRUE)
if (!requireNamespace("rsconnect", quietly = TRUE)) {
install.packages("rsconnect", repos = "https://cloud.r-project.org")
}
account <- Sys.getenv("RSCONNECT_ACCOUNT")
app_name <- Sys.getenv("RSCONNECT_APPNAME", "safety-pharm-design-simulater")
token <- Sys.getenv("SHINYAPPS_TOKEN")
secret <- Sys.getenv("SHINYAPPS_SECRET")
if (!nzchar(account)) {
stop("Set RSCONNECT_ACCOUNT before deploying.")
}
if (!nzchar(token) || !nzchar(secret)) {
stop("Set SHINYAPPS_TOKEN and SHINYAPPS_SECRET before deploying.")
}
rsconnect::setAccountInfo(
name = account,
token = token,
secret = secret
)
rsconnect::deployApp(
appDir = app_dir,
appPrimaryDoc = "app.R",
account = account,
server = "shinyapps.io",
appName = app_name,
forceUpdate = TRUE
)