forked from rstudio/shinyapps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6376f0f
commit 11cefb8
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ Collate: | |
'deployApp.R' | ||
'scaleApp.R' | ||
'terminateApp.R' | ||
'configureApp.R' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ export(removeAccount) | |
export(scaleApp) | ||
export(setAccountInfo) | ||
export(terminateApp) | ||
export(configureApp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#' Configure an Application | ||
#' | ||
#' Configure an application currently running on ShinyApps. Note, applications | ||
#' should be re-deployed after being reconfigured. You can bypass application | ||
#' upload by using the upload=FALSE parameter to deployApp. | ||
#' @param appName Name of application to configure | ||
#' @param account Account name. If a single account is registered on the | ||
#' system then this parameter can be omitted. | ||
#' @param size Configure application instance size | ||
#' @param instances Configure number of application instances | ||
#' @examples | ||
#' \dontrun{ | ||
#' | ||
#' # set instance size for an application | ||
#' configureApp("myapp", size="xlarge") | ||
#' } | ||
#' @seealso \code{\link{applications}}, \code{\link{deployApp}} | ||
#' @export | ||
configureApp <- function(appName, account = NULL, quiet = FALSE, size = NULL, instances = NULL) { | ||
|
||
# resolve target account and application | ||
accountInfo <- accountInfo(resolveAccount(account)) | ||
application <- resolveApplication(accountInfo, appName) | ||
|
||
# get a list of properties to set | ||
properties <- list() | ||
if (! is.null(size) ) { | ||
properties[[ "containers.template" ]] = size | ||
} | ||
if (! is.null(instances) ) { | ||
properties[[ "containers.count" ]] = instances | ||
} | ||
|
||
# set application properties | ||
lucid <- lucidClient(accountInfo) | ||
for (i in names(properties)) { | ||
propertyName <- i | ||
propertyValue <- properties[[i]] | ||
lucid$configureApplication(application$id, propertyName, propertyValue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters