File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/modules/vault/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -110,18 +110,26 @@ export class StartedVaultContainer extends AbstractStartedContainer {
110110 }
111111
112112 /**
113- * Executes a list of Vault CLI commands inside the container after it has started.
113+ * Executes Vault CLI commands inside the container after it has started.
114114 *
115115 * This is typically used to pre-configure secret engines or seed test data.
116116 *
117- * @param commands Array of CLI commands (without `vault` prefix)
117+ * @example
118+ * await container.execVaultCommands([
119+ * "secrets enable transit",
120+ * "write -f transit/keys/my-key",
121+ * "kv put secret/my-secret value=123",
122+ * ]);
123+ *
124+ * @param commands Array of Vault CLI commands (without the `vault` prefix)
125+ * @throws If the command fails (non-zero exit code)
118126 */
119127 public async execVaultCommands ( commands : string [ ] ) : Promise < void > {
120128 const cmd = commands . map ( ( c ) => `vault ${ c } ` ) . join ( " && " ) ;
121129 const result = await this . exec ( [ "/bin/sh" , "-c" , cmd ] ) ;
122130
123131 if ( result . exitCode !== 0 ) {
124- throw new Error ( `Vault init commands failed : ${ result . output } ` ) ;
132+ throw new Error ( `execVaultCommands failed with exit code ${ result . exitCode } : ${ result . output } ` ) ;
125133 }
126134 }
127135}
You can’t perform that action at this time.
0 commit comments