Skip to content

Commit 7011b5f

Browse files
Remove prefix arg from connect() and just use usual env vars everywhere
1 parent e628e7c commit 7011b5f

28 files changed

+212
-240
lines changed

.github/workflows/integration-tests.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,5 @@ jobs:
5353
with:
5454
version: ${{ matrix.version }}
5555
license: ${{ secrets.CONNECT_LICENSE_FILE }}
56-
# TODO: rewrite tests to use CONNECT_* env vars directly
5756
command: |
58-
Rscript -e '
59-
Sys.setenv(
60-
TEST_1_SERVER=Sys.getenv("CONNECT_SERVER"),
61-
TEST_1_API_KEY=Sys.getenv("CONNECT_API_KEY")
62-
)
63-
source("tests/test-integrated.R")'
57+
Rscript -e 'source("tests/test-integrated.R")'

.github/workflows/pkgdown.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ jobs:
4040
license: ${{ secrets.CONNECT_LICENSE_FILE }}
4141
# TODO: rewrite tests to use CONNECT_* env vars directly
4242
command: |
43-
Rscript -e '
44-
Sys.setenv(
45-
TEST_1_SERVER=Sys.getenv("CONNECT_SERVER"),
46-
TEST_1_API_KEY=Sys.getenv("CONNECT_API_KEY")
47-
)
48-
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)'
43+
Rscript -e 'pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)'
4944
5045
- name: Deploy to GitHub pages 🚀
5146
if: github.event_name != 'pull_request'

.github/workflows/test-coverage.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,11 @@ jobs:
3838
# TODO: rewrite tests to use CONNECT_* env vars directly
3939
command: |
4040
Rscript -e '
41-
Sys.setenv(
42-
TEST_1_SERVER=Sys.getenv("CONNECT_SERVER"),
43-
TEST_1_API_KEY=Sys.getenv("CONNECT_API_KEY")
44-
)
45-
token <- "${{ secrets.CODECOV_TOKEN }}"
4641
covr::codecov(
4742
quiet = FALSE,
4843
clean = FALSE,
4944
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"),
50-
token = if (token != "") token
45+
token = "${{ secrets.CODECOV_TOKEN }}"
5146
)'
5247
5348

R/connect.R

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,6 @@ Connect <- R6::R6Class(
963963
#' `Connect` object using the `api_key`. By providing a different
964964
#' key here you can test a visitor client with differently-scoped
965965
#' permissions.
966-
#' @param prefix The prefix used to determine environment variables
967966
#' @param audience Optional. The GUID of a Connect API integration associated with this piece of content.
968967
#' @param ... Additional arguments. Not used at present
969968
#' @param .check_is_fatal Whether to fail if "check" requests fail. Useful in
@@ -991,16 +990,14 @@ Connect <- R6::R6Class(
991990
#' @examplesIf identical(Sys.getenv("IN_PKGDOWN"), "true")
992991
#'
993992
#' # default is to read CONNECT_SERVER and CONNECT_API_KEY environment variables
994-
#' # this example will read TEST_1_SERVER and TEST_1_API_KEY
995-
#' connect(prefix = "TEST_1")
993+
#' connect()
996994
#'
997995
#' @export
998996
connect <- function(
999-
server = Sys.getenv(paste0(prefix, "_SERVER"), NA_character_),
1000-
api_key = Sys.getenv(paste0(prefix, "_API_KEY"), NA_character_),
997+
server = Sys.getenv("CONNECT_SERVER"),
998+
api_key = Sys.getenv("CONNECT_API_KEY"),
1001999
token,
10021000
token_local_testing_key = api_key,
1003-
prefix = "CONNECT",
10041001
audience = NULL,
10051002
...,
10061003
.check_is_fatal = TRUE

R/deploy.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ download_bundle <- function(
402402
#' }
403403
#' @examplesIf identical(Sys.getenv("IN_PKGDOWN"), "true")
404404
#'
405-
#' client <- connect(prefix = "TEST_1")
405+
#' client <- connect()
406406
#' bnd <- bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi"))
407407
#' deploy(client, bnd)
408408
#'
@@ -413,8 +413,7 @@ deploy <- function(
413413
title = name,
414414
guid = NULL,
415415
...,
416-
.pre_deploy = {
417-
}
416+
.pre_deploy = {}
418417
) {
419418
validate_R6_class(bundle, "Bundle")
420419
validate_R6_class(connect, "Connect")

man/bundle_dir.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bundle_path.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bundle_static.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/connect.Rd

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/deploy.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)