Safely load command scripts

This commit is contained in:
Joseph Garrone 2024-05-18 08:56:11 +02:00
parent c8d2866ada
commit a2563f0b7d

View File

@ -66,10 +66,12 @@ program
}) })
.task({ .task({
skip, skip,
"handler": async cliCommandOptions => { "handler": cliCommandOptions =>
const { command } = await import("./keycloakify"); runAndLogErrors(async () => {
await runAndLogErrors(() => command({ cliCommandOptions })); const { command } = await import("./keycloakify");
}
await runAndLogErrors(() => command({ cliCommandOptions }));
})
}); });
program program
@ -79,10 +81,12 @@ program
}) })
.task({ .task({
skip, skip,
"handler": async cliCommandOptions => { "handler": cliCommandOptions =>
const { command } = await import("./download-builtin-keycloak-theme"); runAndLogErrors(async () => {
await runAndLogErrors(() => command({ cliCommandOptions })); const { command } = await import("./download-builtin-keycloak-theme");
}
await runAndLogErrors(() => command({ cliCommandOptions }));
})
}); });
program program
@ -92,10 +96,12 @@ program
}) })
.task({ .task({
skip, skip,
"handler": async cliCommandOptions => { "handler": cliCommandOptions =>
const { command } = await import("./eject-keycloak-page"); runAndLogErrors(async () => {
await runAndLogErrors(() => command({ cliCommandOptions })); const { command } = await import("./eject-keycloak-page");
}
await runAndLogErrors(() => command({ cliCommandOptions }));
})
}); });
program program
@ -105,10 +111,12 @@ program
}) })
.task({ .task({
skip, skip,
"handler": async cliCommandOptions => { "handler": cliCommandOptions =>
const { command } = await import("./initialize-email-theme"); runAndLogErrors(async () => {
await runAndLogErrors(() => command({ cliCommandOptions })); const { command } = await import("./initialize-email-theme");
}
await runAndLogErrors(() => command({ cliCommandOptions }));
})
}); });
program program
@ -118,10 +126,12 @@ program
}) })
.task({ .task({
skip, skip,
"handler": async cliCommandOptions => { "handler": cliCommandOptions =>
const { command } = await import("./start-keycloak-container"); runAndLogErrors(async () => {
await runAndLogErrors(() => command({ cliCommandOptions })); const { command } = await import("./start-keycloak-container");
}
await runAndLogErrors(() => command({ cliCommandOptions }));
})
}); });
program program
@ -131,10 +141,12 @@ program
}) })
.task({ .task({
skip, skip,
"handler": async cliCommandOptions => { "handler": cliCommandOptions =>
const { command } = await import("./copy-keycloak-resources-to-public"); runAndLogErrors(async () => {
await runAndLogErrors(() => command({ cliCommandOptions })); const { command } = await import("./copy-keycloak-resources-to-public");
}
await runAndLogErrors(() => command({ cliCommandOptions }));
})
}); });
// Fallback to build command if no command is provided // Fallback to build command if no command is provided