From b8597de69ce074cf718ef4b64eec1e44067f3e74 Mon Sep 17 00:00:00 2001 From: Hong Ooi Date: Mon, 15 Apr 2019 15:00:50 +1000 Subject: [PATCH] allow import given filename --- R/certificates.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/certificates.R b/R/certificates.R index 93b10cf..e433a2d 100644 --- a/R/certificates.R +++ b/R/certificates.R @@ -80,10 +80,12 @@ public=list( attributes=vault_object_attrs(), ..., wait=TRUE) { + if(is.character(value) && length(value) == 1 && file.exists(value)) + value <- readBin(value, "raw", file.info(value)$size) + body <- list(value=value, pwd=pwd, attributes=attributes, tags=list(...)) - op <- construct_path(name, "import") - self$do_operation(op, body=body, encode="json", http_verb="POST") + self$do_operation(construct_path(name, "import"), body=body, encode="json", http_verb="POST") cert <- self$get(name) if(!wait)