fix : env

This commit is contained in:
2026-03-12 09:42:28 +01:00
parent b6375b4242
commit 7643600196
3 changed files with 16 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ function getCommand(source: DiskSource) {
const legacyEnvKey =
source.key === "remote" ? "DISK_REMOTE_COMMAND" : source.key === "local" ? "DISK_LOCAL_COMMAND" : ""
return process.env[envKey] || (legacyEnvKey ? process.env[legacyEnvKey] : undefined) || source.command
return process.env[envKey] || (legacyEnvKey ? process.env[legacyEnvKey] : undefined) || null
}
function runCommand(command: string): Promise<string> {
@@ -31,7 +31,13 @@ export default defineEventHandler(async () => {
const results = await Promise.all(
(diskSources as DiskSource[]).map(async (source) => {
try {
const output = await runCommand(getCommand(source))
const command = getCommand(source)
if (!command) {
throw new Error(`Commande manquante pour ${source.key}`)
}
const output = await runCommand(command)
return {
key: source.key,
label: source.label,