R/ojo_check_ssl.R

Defines functions ojo_check_ssl

Documented in ojo_check_ssl

#' Check whether the database connection is using SSL properly
#'
#' @export ojo_check_ssl
#'
#' @param ... Placeholder
#' @param .con The ojodb connection to use
#'
#' @return A logical indicator of whether the db connection is properly using SSL
#' @examples
#' \dontrun{
#' # Identifies the table
#' ojo_check_ssl()
#' }
#'
ojo_check_ssl <- function(..., .con = NULL) {
  if (is.null(.con)) {
    .con <- ojo_connect()
  }

  pool_src <- pool::poolCheckout(.con)
  on.exit(pool::poolReturn(pool_src))
  pool_src |>
    pool::dbGetQuery("select * from pg_stat_ssl where pid = pg_backend_pid();")
}
openjusticeok/ojodb documentation built on Aug. 4, 2024, 3:25 p.m.