Skip to content
Snippets Groups Projects
Commit 2f0d6a2f 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 a69e1c11
No related branches found
No related tags found
No related merge requests found
Pipeline #51495 failed with stage
in 39 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