forked from vimc/vaultr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
89 lines (63 loc) · 2.32 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# vaultr
<!-- badges: start -->
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![codecov.io](https://codecov.io/github/vimc/vaultr/coverage.svg?branch=master)](https://codecov.io/github/vimc/vaultr?branch=master)
[![](http://www.r-pkg.org/badges/version/vaultr)](https://cran.r-project.org/package=vaultr)
[![R-CMD-check](https://github.com/vimc/vaultr/workflows/R-CMD-check/badge.svg)](https://github.com/vimc/vaultr/actions
)[![CodeFactor](https://www.codefactor.io/repository/github/vimc/vaultr/badge)](https://www.codefactor.io/repository/github/vimc/vaultr)
<!-- badges: end -->
API client for [vault](https://www.vaultproject.io/).
Vault provides a platform for distributing secrets across machines. This package wraps the [vault http API](https://www.vaultproject.io/api/index.html) to allow secrets to be accessed from R. Secrets might be passwords, tokens, certificates or any other sensitive data.
## Usage
```{r, include = FALSE}
srv <- vaultr::vault_test_server()
srv$export()
local({
cl <- srv$client()
cl$write("/secret/database/admin", list(value = "s3cret"))
cl$write("/secret/database/readonly", list(value = "passw0rd"))
})
knitr::opts_chunk$set(error = FALSE)
```
Create a vault client with the `vault_client` function:
```{r}
vault <- vaultr::vault_client(login = TRUE)
```
Interact with vault using this object:
```{r}
vault$list("secret/database")
```
and read secrets with
```{r}
vault$read("secret/database/admin")
```
```{r}
vault$read("secret/database/readonly", field = "value")
```
or set secrets with
```r
vault$write("secret/webserver", list(password = "horsestaple"))
vault$read("secret/webserver")
```
or delete secrets with
```r
vault$delete("/secret/database/readonly")
```
## Installation
Install `vaultr` from CRAN with
```r
install.packages("vaultr")
```
To install our internally released version (which might be ahead of CRAN) via drat, use
```r
# install.packages("drat") # (if needed)
drat:::add("vimc")
install.packages("vaultr")
```
or install the bleeding edge with
```r
# install.packages("devtools") # (if needed)
devtools::install_gitub("vimc/vaultr", upgrade = FALSE)
```
## License
MIT © Imperial College of Science, Technology and Medicine