R/zzz.R

Defines functions etcdbase etcdhost etcdport etc asl contutf8 etcd_parse make_auth check_key

etcdbase <- function() "http://127.0.0.1:2379/v2/"
etcdhost <- function() "127.0.0.1"
etcdport <- function() "2379"

etc <- function(l) Filter(Negate(is.null), l)

asl <- function(z) {
  if (is.logical(z) || tolower(z) == "true" || tolower(z) == "false") {
    if (z) {
      return('true')
    } else {
      return('false')
    }
  } else {
    return(z)
  }
}

contutf8 <- function(x) {
  content(x, "text", encoding = "UTF-8")
}

etcd_parse <- function(x, simplify=FALSE){
  jsonlite::fromJSON(x, simplify)
}

make_auth <- function(user, pwd) {
  authenticate(user, pwd)
}

check_key <- function(x) {
  if (!grepl("^/", x)) {
    stop("The key must be prefixed by a '/'", call. = FALSE)
  }
  return(x)
}

Try the etseed package in your browser

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

etseed documentation built on May 2, 2019, 10:20 a.m.