R/conf.R

Defines functions notebookutils.conf.get notebookutils.conf.set

Documented in notebookutils.conf.get notebookutils.conf.set

#' conf.R: Utility for notebookutils configuration
#'
#' @noRd
.confEnv <- new.env(parent = emptyenv())

#' Set a config key/value
#'
#' Dummy in-memory implementation for local development.
#'
#' @param key Config key
#' @param value Config value
#' @export
notebookutils.conf.set <- function(key, value) {
  assign(as.character(key), as.character(value), envir = .confEnv)
  invisible(NULL)
}

#' Get a config value
#'
#' Dummy in-memory implementation for local development.
#'
#' @param key Config key
#' @param default Default value when key is missing
#' @export
notebookutils.conf.get <- function(key, default = "") {
  k <- as.character(key)
  if (exists(k, envir = .confEnv, inherits = FALSE)) {
    get(k, envir = .confEnv, inherits = FALSE)
  } else {
    as.character(default)
  }
}

Try the notebookutils package in your browser

Any scripts or data that you put into this service are public.

notebookutils documentation built on Jan. 26, 2026, 9:06 a.m.