aboutsummaryrefslogtreecommitdiff
path: root/echo
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2022-11-23 15:32:45 -0800
committerMike Crute <mike@crute.us>2022-11-23 15:32:45 -0800
commita1e017514304206e2fccd72eaa6825f1d7911c79 (patch)
treea2ba3c2f2003b84b7c1d9a6dfe7963d73a4b829d /echo
parentdb793c7ca3b80e7e7e3b2d8668e62cb9f7d2d254 (diff)
downloadgolib-a1e017514304206e2fccd72eaa6825f1d7911c79.tar.bz2
golib-a1e017514304206e2fccd72eaa6825f1d7911c79.tar.xz
golib-a1e017514304206e2fccd72eaa6825f1d7911c79.zip
echo: support secrets APIecho/v0.9.0
Diffstat (limited to 'echo')
-rw-r--r--echo/go.mod17
-rw-r--r--echo/go.sum28
-rw-r--r--echo/vault.go29
3 files changed, 53 insertions, 21 deletions
diff --git a/echo/go.mod b/echo/go.mod
index d62094d..0b1ed59 100644
--- a/echo/go.mod
+++ b/echo/go.mod
@@ -5,14 +5,16 @@ go 1.18
5replace code.crute.us/mcrute/golib => ../ 5replace code.crute.us/mcrute/golib => ../
6 6
7require ( 7require (
8 code.crute.us/mcrute/golib v0.3.6 8 code.crute.us/mcrute/golib v0.4.0
9 code.crute.us/mcrute/golib/clients/netbox v0.1.0 9 code.crute.us/mcrute/golib/clients/netbox v0.1.0
10 code.crute.us/mcrute/golib/secrets v0.1.0
10 code.crute.us/mcrute/golib/vault v0.2.4 11 code.crute.us/mcrute/golib/vault v0.2.4
11 github.com/elnormous/contenttype v1.0.0 12 github.com/elnormous/contenttype v1.0.0
12 github.com/labstack/echo/v4 v4.6.1 13 github.com/labstack/echo/v4 v4.6.1
13 github.com/labstack/gommon v0.3.1 14 github.com/labstack/gommon v0.3.1
14 github.com/prometheus/client_golang v1.11.0 15 github.com/prometheus/client_golang v1.11.0
15 github.com/stretchr/testify v1.7.0 16 github.com/stretchr/testify v1.7.0
17 gopkg.in/square/go-jose.v2 v2.5.1
16) 18)
17 19
18require ( 20require (
@@ -35,16 +37,16 @@ require (
35 github.com/hashicorp/go-retryablehttp v0.6.6 // indirect 37 github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
36 github.com/hashicorp/go-rootcerts v1.0.2 // indirect 38 github.com/hashicorp/go-rootcerts v1.0.2 // indirect
37 github.com/hashicorp/go-secure-stdlib/mlock v0.1.1 // indirect 39 github.com/hashicorp/go-secure-stdlib/mlock v0.1.1 // indirect
38 github.com/hashicorp/go-secure-stdlib/parseutil v0.1.1 // indirect 40 github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
39 github.com/hashicorp/go-secure-stdlib/strutil v0.1.1 // indirect 41 github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
40 github.com/hashicorp/go-sockaddr v1.0.2 // indirect 42 github.com/hashicorp/go-sockaddr v1.0.2 // indirect
41 github.com/hashicorp/go-uuid v1.0.2 // indirect 43 github.com/hashicorp/go-uuid v1.0.2 // indirect
42 github.com/hashicorp/go-version v1.2.0 // indirect 44 github.com/hashicorp/go-version v1.2.0 // indirect
43 github.com/hashicorp/golang-lru v0.5.4 // indirect 45 github.com/hashicorp/golang-lru v0.5.4 // indirect
44 github.com/hashicorp/hcl v1.0.0 // indirect 46 github.com/hashicorp/hcl v1.0.0 // indirect
45 github.com/hashicorp/vault/api v1.5.0 // indirect 47 github.com/hashicorp/vault/api v1.8.0 // indirect
46 github.com/hashicorp/vault/api/auth/approle v0.1.1 // indirect 48 github.com/hashicorp/vault/api/auth/approle v0.3.0 // indirect
47 github.com/hashicorp/vault/sdk v0.4.1 // indirect 49 github.com/hashicorp/vault/sdk v0.6.0 // indirect
48 github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect 50 github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
49 github.com/mattn/go-colorable v0.1.11 // indirect 51 github.com/mattn/go-colorable v0.1.11 // indirect
50 github.com/mattn/go-isatty v0.0.14 // indirect 52 github.com/mattn/go-isatty v0.0.14 // indirect
@@ -52,7 +54,7 @@ require (
52 github.com/mitchellh/copystructure v1.0.0 // indirect 54 github.com/mitchellh/copystructure v1.0.0 // indirect
53 github.com/mitchellh/go-homedir v1.1.0 // indirect 55 github.com/mitchellh/go-homedir v1.1.0 // indirect
54 github.com/mitchellh/go-testing-interface v1.0.0 // indirect 56 github.com/mitchellh/go-testing-interface v1.0.0 // indirect
55 github.com/mitchellh/mapstructure v1.4.2 // indirect 57 github.com/mitchellh/mapstructure v1.5.0 // indirect
56 github.com/mitchellh/reflectwalk v1.0.0 // indirect 58 github.com/mitchellh/reflectwalk v1.0.0 // indirect
57 github.com/oklog/run v1.0.0 // indirect 59 github.com/oklog/run v1.0.0 // indirect
58 github.com/pierrec/lz4 v2.5.2+incompatible // indirect 60 github.com/pierrec/lz4 v2.5.2+incompatible // indirect
@@ -72,6 +74,5 @@ require (
72 google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect 74 google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
73 google.golang.org/grpc v1.41.0 // indirect 75 google.golang.org/grpc v1.41.0 // indirect
74 google.golang.org/protobuf v1.26.0 // indirect 76 google.golang.org/protobuf v1.26.0 // indirect
75 gopkg.in/square/go-jose.v2 v2.5.1 // indirect
76 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect 77 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
77) 78)
diff --git a/echo/go.sum b/echo/go.sum
index f17007f..63e83e2 100644
--- a/echo/go.sum
+++ b/echo/go.sum
@@ -32,6 +32,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
32cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= 32cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
33code.crute.us/mcrute/golib/clients/netbox v0.1.0 h1:7ae676WtINm2oSLoUw1ERIZ2ndLD5gi7cvv2iZZd1XI= 33code.crute.us/mcrute/golib/clients/netbox v0.1.0 h1:7ae676WtINm2oSLoUw1ERIZ2ndLD5gi7cvv2iZZd1XI=
34code.crute.us/mcrute/golib/clients/netbox v0.1.0/go.mod h1:csRsnmAwenAz8Pbo7CcQTWzn6uaXadELIdB81JxsacY= 34code.crute.us/mcrute/golib/clients/netbox v0.1.0/go.mod h1:csRsnmAwenAz8Pbo7CcQTWzn6uaXadELIdB81JxsacY=
35code.crute.us/mcrute/golib/secrets v0.1.0 h1:22W0rLhE5jvIQlsUDQt1soGBEoBn4rl4a883f1yBybI=
36code.crute.us/mcrute/golib/secrets v0.1.0/go.mod h1:O1ypm8JirXI4SekwNCHwQbfsieDQJxeRNwZYoot6fvw=
35code.crute.us/mcrute/golib/vault v0.2.4 h1:lNc1hq26e/UAGBqxQlZiFffOXZSNEcEkKUzU3oRJ8Eg= 37code.crute.us/mcrute/golib/vault v0.2.4 h1:lNc1hq26e/UAGBqxQlZiFffOXZSNEcEkKUzU3oRJ8Eg=
36code.crute.us/mcrute/golib/vault v0.2.4/go.mod h1:23C5g8O0zaeFfo7v6sCO0RKgnHIiHM9ku+ASOWHJD9k= 38code.crute.us/mcrute/golib/vault v0.2.4/go.mod h1:23C5g8O0zaeFfo7v6sCO0RKgnHIiHM9ku+ASOWHJD9k=
37dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 39dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
@@ -177,7 +179,7 @@ github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39
177github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= 179github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
178github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= 180github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
179github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= 181github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
180github.com/hashicorp/go-kms-wrapping/entropy v0.1.0/go.mod h1:d1g9WGtAunDNpek8jUIEJnBlbgKS1N2Q61QkHiZyR1g= 182github.com/hashicorp/go-kms-wrapping/entropy/v2 v2.0.0/go.mod h1:xvb32K2keAc+R8DSFG2IwDcydK9DBQE+fGA5fsw6hSk=
181github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= 183github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
182github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= 184github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
183github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= 185github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
@@ -191,11 +193,13 @@ github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR3
191github.com/hashicorp/go-secure-stdlib/base62 v0.1.1/go.mod h1:EdWO6czbmthiwZ3/PUsDV+UD1D5IRU4ActiaWGwt0Yw= 193github.com/hashicorp/go-secure-stdlib/base62 v0.1.1/go.mod h1:EdWO6czbmthiwZ3/PUsDV+UD1D5IRU4ActiaWGwt0Yw=
192github.com/hashicorp/go-secure-stdlib/mlock v0.1.1 h1:cCRo8gK7oq6A2L6LICkUZ+/a5rLiRXFMf1Qd4xSwxTc= 194github.com/hashicorp/go-secure-stdlib/mlock v0.1.1 h1:cCRo8gK7oq6A2L6LICkUZ+/a5rLiRXFMf1Qd4xSwxTc=
193github.com/hashicorp/go-secure-stdlib/mlock v0.1.1/go.mod h1:zq93CJChV6L9QTfGKtfBxKqD7BqqXx5O04A/ns2p5+I= 195github.com/hashicorp/go-secure-stdlib/mlock v0.1.1/go.mod h1:zq93CJChV6L9QTfGKtfBxKqD7BqqXx5O04A/ns2p5+I=
194github.com/hashicorp/go-secure-stdlib/parseutil v0.1.1 h1:78ki3QBevHwYrVxnyVeaEz+7WtifHhauYF23es/0KlI=
195github.com/hashicorp/go-secure-stdlib/parseutil v0.1.1/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= 196github.com/hashicorp/go-secure-stdlib/parseutil v0.1.1/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
197github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ=
198github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
196github.com/hashicorp/go-secure-stdlib/password v0.1.1/go.mod h1:9hH302QllNwu1o2TGYtSk8I8kTAN0ca1EHpwhm5Mmzo= 199github.com/hashicorp/go-secure-stdlib/password v0.1.1/go.mod h1:9hH302QllNwu1o2TGYtSk8I8kTAN0ca1EHpwhm5Mmzo=
197github.com/hashicorp/go-secure-stdlib/strutil v0.1.1 h1:nd0HIW15E6FG1MsnArYaHfuw9C2zgzM8LxkG5Ty/788=
198github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= 200github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U=
201github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts=
202github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
199github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.1/go.mod h1:l8slYwnJA26yBz+ErHpp2IRCLr0vuOMGBORIz4rRiAs= 203github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.1/go.mod h1:l8slYwnJA26yBz+ErHpp2IRCLr0vuOMGBORIz4rRiAs=
200github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= 204github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
201github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= 205github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
@@ -210,14 +214,12 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l
210github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= 214github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
211github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= 215github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
212github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= 216github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
213github.com/hashicorp/vault/api v1.3.0/go.mod h1:EabNQLI0VWbWoGlA+oBLC8PXmR9D60aUVgQGvangFWQ= 217github.com/hashicorp/vault/api v1.8.0 h1:7765sW1XBt+qf4XKIYE4ebY9qc/yi9V2/egzGSUNMZU=
214github.com/hashicorp/vault/api v1.5.0 h1:Bp6yc2bn7CWkOrVIzFT/Qurzx528bdavF3nz590eu28= 218github.com/hashicorp/vault/api v1.8.0/go.mod h1:uJrw6D3y9Rv7hhmS17JQC50jbPDAZdjZoTtrCCxxs7E=
215github.com/hashicorp/vault/api v1.5.0/go.mod h1:LkMdrZnWNrFaQyYYazWVn7KshilfDidgVBq6YiTq/bM= 219github.com/hashicorp/vault/api/auth/approle v0.3.0 h1:Ib0oCNXsCq/QZhPYtXPzJEbGS5WR/KoZf8c84QoFdkU=
216github.com/hashicorp/vault/api/auth/approle v0.1.1 h1:R5yA+xcNvw1ix6bDuWOaLOq2L4L77zDCVsethNw97xQ= 220github.com/hashicorp/vault/api/auth/approle v0.3.0/go.mod h1:hm51TbjzUkPO0Y17wkrpwOpvyyMRpXJNueTHiG04t3k=
217github.com/hashicorp/vault/api/auth/approle v0.1.1/go.mod h1:mHOLgh//xDx4dpqXoq6tS8Ob0FoCFWLU2ibJ26Lfmag= 221github.com/hashicorp/vault/sdk v0.6.0 h1:6Z+In5DXHiUfZvIZdMx7e2loL1PPyDjA4bVh9ZTIAhs=
218github.com/hashicorp/vault/sdk v0.3.0/go.mod h1:aZ3fNuL5VNydQk8GcLJ2TV8YCRVvyaakYkhZRoVuhj0= 222github.com/hashicorp/vault/sdk v0.6.0/go.mod h1:+DRpzoXIdMvKc88R4qxr+edwy/RvH5QK8itmxLiDHLc=
219github.com/hashicorp/vault/sdk v0.4.1 h1:3SaHOJY687jY1fnB61PtL0cOkKItphrbLmux7T92HBo=
220github.com/hashicorp/vault/sdk v0.4.1/go.mod h1:aZ3fNuL5VNydQk8GcLJ2TV8YCRVvyaakYkhZRoVuhj0=
221github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= 223github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=
222github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= 224github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
223github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= 225github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
@@ -276,8 +278,8 @@ github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdI
276github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 278github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
277github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= 279github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
278github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 280github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
279github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= 281github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
280github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 282github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
281github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= 283github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
282github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= 284github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
283github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 285github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
diff --git a/echo/vault.go b/echo/vault.go
index 40096fe..13a7407 100644
--- a/echo/vault.go
+++ b/echo/vault.go
@@ -3,11 +3,16 @@ package echo
3import ( 3import (
4 "context" 4 "context"
5 5
6 "code.crute.us/mcrute/golib/secrets"
6 "code.crute.us/mcrute/golib/service" 7 "code.crute.us/mcrute/golib/service"
7 "code.crute.us/mcrute/golib/vault" 8 "code.crute.us/mcrute/golib/vault"
8 "github.com/labstack/echo/v4" 9 "github.com/labstack/echo/v4"
9) 10)
10 11
12// MakeVaultClient creates a VaultClient with default configuration and
13// adds it to the service runner with a logger.
14//
15// Deprecated: Use MakeVaultSecretsClient and AttachSecretsClient instead.
11func MakeVaultClient(ctx context.Context, runner *service.AppRunner, log echo.Logger) (vault.VaultClient, error) { 16func MakeVaultClient(ctx context.Context, runner *service.AppRunner, log echo.Logger) (vault.VaultClient, error) {
12 certRenewal := make(chan *vault.Renewal, 10) 17 certRenewal := make(chan *vault.Renewal, 10)
13 18
@@ -25,3 +30,27 @@ func MakeVaultClient(ctx context.Context, runner *service.AppRunner, log echo.Lo
25 30
26 return c, nil 31 return c, nil
27} 32}
33
34// MakeVaultSecretsClient creates a secrets.ClientManager connected to
35// Vault and authenticates it.
36func MakeVaultSecretsClient(ctx context.Context) (secrets.ClientManager, error) {
37 vc, err := secrets.NewVaultClient(&secrets.VaultClientConfig{})
38 if err != nil {
39 return nil, err
40 }
41
42 if err = vc.Authenticate(ctx); err != nil {
43 return nil, err
44 }
45
46 return vc, nil
47}
48
49// AttachSecretsClient attaches a secrets client to a runner and
50// configures logger and failure handler to run asynchronously. The
51// failure handler will terminate the application if a critical
52// credential renewal failure occurs.
53func AttachSecretsClient(c secrets.ClientManager, cancel func(), run *service.AppRunner, log echo.Logger) {
54 run.AddBackgroundJob(c.Run)
55 run.AddBackgroundJob(secrets.MakeRenewalLogger(c, log, cancel))
56}