Skip to content

Commit

Permalink
Don't print secret env
Browse files Browse the repository at this point in the history
  • Loading branch information
weshinsley committed Jul 8, 2024
1 parent c42d0a4 commit 3183964
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 2 additions & 6 deletions R/task.R
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,8 @@ print_info_data <- function(data) {
}
cli::cli_li("Environment: {data$environment}")
if (NROW(data$envvars) > 0) {
cli::cli_li("Environment variables:")
env_vars_ul <- cli::cli_ul()
for (n in seq_along(data$envvars$name)) {
cli::cli_li("{data$envvars$name[n]} = {data$envvars$value[n]}")
}
cli::cli_end(env_vars_ul)
data$envvars$value[data$envvars$secret] <- "********"
cli::cli_dl(items = set_names(data$envvars$value, data$envvars$name))
}
if (!is.null(data$path) && data$path != ".") {
cli::cli_li("Relative path: {data$path}")
Expand Down
11 changes: 6 additions & 5 deletions tests/testthat/test-task.R
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,13 @@ test_that("can print information about task data for expression-based tasks", {

data4 <- data
data4$envvars <- hipercow_envvars(X = "x", Y = "y", "Z" = "z")
data4$envvars$secret[data4$envvars$name == "Z"] <- TRUE
msg4 <- capture_messages(print_info_data(data4))
expect_length(msg4, 8)
expect_match(msg4[[5]], "Environment variables:")
expect_match(msg4[[6]], "X = x")
expect_match(msg4[[7]], "Y = y")
expect_match(msg4[[8]], "Z = z")
expect_length(msg4, 7)
expect_match(msg4[[4]], "Environment: default")
expect_match(msg4[[5]], "X: x")
expect_match(msg4[[6]], "Y: y")
expect_match(msg4[[7]], "Z: \\*\\*\\*\\*\\*\\*")
expect_equal(msg4[1:4], msg)
})

Expand Down

0 comments on commit 3183964

Please sign in to comment.