package secrets // This file contains convenience functions for working with a secrets // client. These will be mostly only useful in the main method of // a program because most of them are designed to terminate the // application with a log message or panic. import ( "context" "log" ) func MustGetApiKey(c Client, ctx context.Context, path string) *ApiKey { key := &ApiKey{} if _, err := c.Secret(ctx, path, key); err != nil { log.Fatalf("Error fetching API key secret %s: %s", path, err) } return key } func MustGetCredential(c Client, ctx context.Context, path string) *Credential { cred := &Credential{} if _, err := c.Secret(ctx, path, cred); err != nil { log.Fatalf("Error fetching credential secret %s: %s", path, err) } return cred } func MustGetRSAKey(c Client, ctx context.Context, path string) *RSAKey { key := &RSAKey{} if _, err := c.Secret(ctx, path, key); err != nil { log.Fatalf("Error fetching RSA key %s: %s", path, err) } return key }