From 217b3734fd0750db45a2f11b5bd5c57f24a9201f Mon Sep 17 00:00:00 2001 From: John Bradley Date: Fri, 5 Mar 2021 14:00:06 -0500 Subject: [PATCH] Adds PHENOSCAPE_API environment variable Adds PHENOSCAPE_API environment variable that will override the base API URL when set. The default API URL is https://kb.phenoscape.org/api. Running tests with the dev instance can be done like so: ``` PHENOSCAPE_API=https://stars-app.renci.org/phenoscape-dev-api Rscript -e 'devtools::test()' ``` --- R/pkb_get.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/pkb_get.R b/R/pkb_get.R index c9ecc17..5c80e12 100644 --- a/R/pkb_get.R +++ b/R/pkb_get.R @@ -120,7 +120,7 @@ get_nexml_data <- function(url, query, verbose = FALSE, forceGET = FALSE) { pkb_api <- function(...) { path <- paste(..., sep = "/") if (! startsWith(path, "/")) path <- paste0("/", path) - paste0("https://kb.phenoscape.org/api", path) + paste0(phenoscape_api, path) } #' Creates a list of named query parameters @@ -210,4 +210,6 @@ ua <- local({ } .ua } -}) \ No newline at end of file +}) + +phenoscape_api <- Sys.getenv("PHENOSCAPE_API", "https://kb.phenoscape.org/api") \ No newline at end of file