#' set_tarpan_host
#'
#' Wrapper to set the Tarpan 2.0 host. Default host is
#' tarpan.globalparametrics.com. Other host options include \code{localhost} or
#' the IP address of a virtual SQL server.
#'
#' @param host The default GP server (tarpan.globalparametrics.com), local SQL
#' server (localhost), or the IP address of a SQL server
#'
#' @export
set_tarpan_host <- function(host = "tarpan.globalparametrics.com") {
.tarpan$config$host <- host
tarpan2_disconnect()
invisible()
}
#' set_tarpan_credentials
#'
#' Set or update Tarpan 2 credentials. Run without arguments
#' interactively for prompts, or provide values directly.
#'
#' @param user Username for accessing Tarpan 2
#' @param password Password for accessing Tarpan 2
#' @param cache Whether to save to tarpan config file (defaults to
#' ~/.tarpan_readonly_config)
#' @param rsa_key_location character - the file path to the rsa key to use
#'
#' @export
set_tarpan_credentials <- function(user, password, rsa_key_location, cache = TRUE) {
missing_params <- c(missing(user), missing(password))
if (!all(missing_params)) {
if (!missing(user))
.tarpan$config$user <- tarpan_encrypt_value(user)
if (!missing(password))
.tarpan$config$password <- tarpan_encrypt_value(password)
if (!missing(rsa_key_location))
.tarpan$config$key_location <- rsa_key_location
} else if (interactive() && all(missing_params)) {
.tarpan$config$key_location <- trimws(
readline("Location of SSH/RSA key (leave blank for ~/.ssh/id_rsa): ")
)
load_rsa_key()
.tarpan$config$user <- tarpan_encrypt_value(
readline("username: ")
)
.tarpan$config$password <- tarpan_encrypt_value(
getPass("password: ", noblank = TRUE)
)
} else {
stop("Must provide credentials via function arguments or run ",
"interactively.")
}
if (isTRUE(cache)) {
config_file <- tarpan_config_file()
write_json(.tarpan$config, config_file)
Sys.chmod(config_file, "0700")
message("Tarpan credentials updated and saved to config file.")
} else
message("Tarpan credentials updated.")
invisible()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.