Skip to content

Commit

Permalink
update to new REDCap endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vortexing committed Apr 20, 2020
1 parent 9fb3f5a commit 58076c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tgR
Type: Package
Title: TGR Convenience Functions
Version: 0.5.1
Version: 0.6.0
Author: Amy Paguirigan
Maintainer: Amy Paguirigan <[email protected]>
Description: This package provides helper functions needed to coordinate between various aspects of repository.
Expand Down
5 changes: 4 additions & 1 deletion R/setCreds.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#' Requires the desired REDCap and S3 credentials to be set in the environment or be available in an R file specified.
#' @export
setCreds <- function(path, tokenSet="file") {

if (tokenSet == "file"){
source(path);
}
Expand All @@ -18,13 +19,15 @@ setCreds <- function(path, tokenSet="file") {
Sys.setenv(AWS_ACCESS_KEY_ID=Sys.getenv("PAGAACCESS2"))
Sys.setenv(AWS_SECRET_ACCESS_KEY=Sys.getenv("PAGASECRET2"))
}
Sys.setenv(REDURI="https://cdsweb07.fhcrc.org/redcap/api/")

if ("" %in% Sys.getenv(c("AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"))) {
# if the person is still using the old set of creds, repurpose them
Sys.setenv(AWS_ACCESS_KEY_ID= Sys.getenv("S3A"),
AWS_SECRET_ACCESS_KEY = Sys.getenv("S3SA"))
}
Sys.setenv(AWS_DEFAULT_REGION = "us-west-2")
Sys.setenv(REDURI="http://redcap.fredhutch.org/api")

if ("" %in% Sys.getenv(c("REDURI", "TGR", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_DEFAULT_REGION"))) {
stop("You have missing environment variables. Please set env vars.")} else message("Credentials set successfully.")
}

0 comments on commit 58076c3

Please sign in to comment.