Skip to content

Commit

Permalink
fixed the base_url issues that were defaulting to AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
vstathias authored Nov 11, 2021
1 parent 838be38 commit 2986672
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions R/put_object.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ function(file,
}
object <- get_objectkey(object)
}

if (missing(base_url)) {
base_url = Sys.getenv("AWS_S3_ENDPOINT")
}


if (missing(region)) {
region = Sys.getenv("AWS_DEFAULT_REGION")
}

if (missing(key)) {
key = Sys.getenv("AWS_ACCESS_KEY_ID")
}

if (missing(secret)) {
secret = Sys.getenv("AWS_SECRET_ACCESS_KEY")
}



acl <- match.arg(acl)
headers <- c(list(`x-amz-acl` = acl), headers)
if (isTRUE(multipart)) {
Expand Down Expand Up @@ -136,11 +156,11 @@ function(file,
parse_response = TRUE,
check_region = FALSE,
url_style = c("path", "virtual"),
base_url = Sys.getenv("AWS_S3_ENDPOINT"),
base_url = base_url,
verbose = getOption("verbose", FALSE),
region = Sys.getenv("AWS_DEFAULT_REGION"),
key = Sys.getenv("AWS_ACCESS_KEY_ID"),
secret = Sys.getenv("AWS_SECRET_ACCESS_KEY"),
region = region,
key = key,
secret = secret,
session_token = NULL,
use_https = FALSE)
return(TRUE)
Expand Down Expand Up @@ -179,11 +199,11 @@ post_object <- function(file, object, bucket, headers = list(), ...) {
parse_response = TRUE,
check_region = FALSE,
url_style = c("path", "virtual"),
base_url = Sys.getenv("AWS_S3_ENDPOINT"),
base_url = base_url,
verbose = getOption("verbose", FALSE),
region = Sys.getenv("AWS_DEFAULT_REGION"),
key = Sys.getenv("AWS_ACCESS_KEY_ID"),
secret = Sys.getenv("AWS_SECRET_ACCESS_KEY"),
region = region,
key = key,
secret = secret,
session_token = NULL,
use_https = FALSE)
structure(r, class = "s3_object")
Expand Down

0 comments on commit 2986672

Please sign in to comment.