Skip to content

Commit b9eba61

Browse files
authored
add check on secret nil (#18)
1 parent 32baa2b commit b9eba61

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/vault_env.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ var vaultEnvCmd = &cobra.Command{
7474
return fmt.Errorf("failed to get secret from Vault: %s", err)
7575
}
7676

77+
// Check if secret exists
78+
if secret == nil {
79+
return fmt.Errorf("no secret found at path %s/%s", viper.GetString("vault-secret-prefix"), viper.GetString("vault-secret"))
80+
}
81+
7782
// Check if data entry exists
7883
data, ok := secret.Data["data"]
7984
if !ok {

0 commit comments

Comments
 (0)