R/mc_config_set.R

Defines functions mc_config_set

Documented in mc_config_set

#' mc_config_set
#' 
#' Edit the config files, e.g. to add a sessionToken
#' @param alias A configured alias, see [mc_alias_set()]
#' @param key the parameter name, e.g. `sessionToken`
#' @param value the value to set the parameter to
#' @param json path to the config
#' @return updates configuration and returns silently (`NULL`). 
#' @examplesIf interactive()
#' 
#' mc_config_set("play", key="sessionToken", value="MyTmpSessionToken")
#' 
#' @export
mc_config_set <- function(alias,
                          key, 
                          value,
                          json = file.path(minio_path(), "config.json")) {
  config <- jsonlite::read_json(json)
  
  config[["aliases"]][[alias]][[key]] <- value
  jsonlite::write_json(config, json)
  
}

Try the minioclient package in your browser

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

minioclient documentation built on Nov. 7, 2023, 5:07 p.m.