Skip to content

Commit

Permalink
Merge pull request #10 from SwanseaUniversityMedical/JS/env
Browse files Browse the repository at this point in the history
Impl. sys env setter for gateway usage
  • Loading branch information
ieuans authored Feb 13, 2024
2 parents 0bb91cf + 8c8ef89 commit bd8a8d0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Package: ConceptLibraryClient
Title: Concept Library API Client
Version: 4.1
Version: 4.2
Authors@R: c(
person("Dan", "Thayer", email = "[email protected]", role = "cre"),
person("Etienne", "Badoche", email = "[email protected]", role = "aut"),
person("Ieuan", "Scanlon", email = "[email protected]", role = "aut"))
person("Ieuan", "Scanlon", email = "[email protected]", role = "aut"),
person("Jack", "Scanlon", email = "[email protected]", role = "aut"))
Description: This package provides functions which mirror the HTTP requests that can be sent to the Concept Library API.
These functions interact with Phenotypes, Concepts, Date Sources, Working Sets and Tags. The Concept Library also
provides a public API, and a function is provided to connect to it instead with no authentication needed.
Expand All @@ -16,7 +17,7 @@ Imports:
License: GPL (>= 3)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.0
RoxygenNote: 7.2.3
Suggests:
testthat (>= 3.0.0),
Config/testthat/edition: 3
4 changes: 4 additions & 0 deletions R/connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Connection <- R6::R6Class(
initialize = function (
username=NA, password=NA, public=FALSE, url=DEFAULT_CONNECTION_URL
) {
if (startsWith(url, DOMAINS$GATEWAY)) {
set_gateway_proxy()
}

if (!public) {
if (is.na(username) || is.na(password)) {
message('Please log in to the Concept Library')
Expand Down
13 changes: 13 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#' set_gateway_proxy
#'
#' @description
#' Sets the user system environment variable to the gateway proxy.
#' This method is only called when the user is utilising the DOMAINS$GATEWAY URL
#'
#' @returns NA
#'
set_gateway_proxy <- function () {
Sys.setenv(http_proxy='http://proxy:8080')
Sys.setenv(https_proxy='http://proxy:8080')
}

#' validate_type
#'
#' @description
Expand Down
15 changes: 15 additions & 0 deletions man/set_gateway_proxy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bd8a8d0

Please sign in to comment.