#' get_s3_board
#' @export
get_s3_board <- function(s3_bucket = "fairml" ,s3_prefix = "thaink2_object/"){
s3_board <- pins::board_s3(
bucket = s3_bucket,
prefix = s3_prefix,
versioned = TRUE,
access_key = Sys.getenv("S3_ACCESS_KEY"),
secret_access_key = Sys.getenv("S3_ACCESS_KEY_SECRET"),
session_token = NULL,
credential_expiration = NULL,
profile = NULL,
region = "eu-west-3",
endpoint = NULL,
cache = NULL)
}
#' load_object_from_cloud
#' @export
load_object_from_cloud <- function(s3_bucket = "belgatrans", s3_prefix = "dashboard/", s3_action = "read", input_data = NULL, data_name = "dashboard_data"){
belgatrans_s3_board <- get_s3_board(s3_bucket = s3_bucket, s3_prefix = s3_prefix)
if(s3_action == "read"){
dashboard_data <- pins::pin_read(board = belgatrans_s3_board, name = data_name )
}
if(s3_action == "write" ){
pins::pin_write(board = belgatrans_s3_board, x = input_data, name = data_name )
dashboard_data <- TRUE
}
return(dashboard_data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.