R/motusSaveSecrets.R

Defines functions motusSaveSecrets

Documented in motusSaveSecrets

#' save secrets for motus web API in default location
#'
#' If the variable MOTUS_SECRETS is not NULL, its contents are stored
#' in JSON format in the package file motusSecrets.json, from where
#' they will be automatically read when the \code{motus} package is
#' loaded.
#'
#' @export
#'
#' @author John Brzustowski \email{jbrzusto@@REMOVE_THIS_PART_fastmail.fm}

motusSaveSecrets = function() {
    if (is.null(MOTUS_SECRETS))
        stop("No Motus API secrets have been loaded.\nUse motusLoadSecrets(FILE)")

    f = file.path(system.file(package="motusServer"), "motusSecrets.json")
    MOTUS_SECRETS %>% toJSON %>% writeLines(f)
}
jbrzusto/motusServer documentation built on May 19, 2019, 8:19 a.m.