Skip to content
Snippets Groups Projects
Commit 7966eb58 authored by Lyuben Penkovski's avatar Lyuben Penkovski
Browse files

Add vault client initialization check

Make a request when creating the client to see if the Vault
is unsealed and available for operation.
parent b4eb87aa
No related branches found
No related tags found
No related merge requests found
Pipeline #51494 failed with stage
in 1 minute and 10 seconds
......@@ -52,7 +52,7 @@ func main() {
vault, err := vault.New(cfg.Vault.Addr, cfg.Vault.Token, httpClient)
if err != nil {
logger.Fatal("cannot create vault client", zap.Error(err))
logger.Fatal("cannot initialize vault client", zap.Error(err))
}
// create services
......
......@@ -35,6 +35,10 @@ func New(addr string, token string, httpClient *http.Client) (*Client, error) {
client.SetToken(token)
if _, err = client.Sys().Capabilities(token, pathSign); err != nil {
return nil, err
}
return &Client{cfg: cfg, client: client}, nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment