mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-15 16:35:17 +00:00
fix: return an empty object if yaml file is empty
This commit is contained in:
@@ -76,7 +76,7 @@ export const loadMiddlewares = <T>() => {
|
|||||||
throw new Error(`File not found: ${configPath}`);
|
throw new Error(`File not found: ${configPath}`);
|
||||||
}
|
}
|
||||||
const yamlStr = readFileSync(configPath, "utf8");
|
const yamlStr = readFileSync(configPath, "utf8");
|
||||||
const config = parse(yamlStr) as T;
|
const config = (parse(yamlStr) ?? {}) as T;
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ export const loadRemoteMiddlewares = async (serverId: string) => {
|
|||||||
console.error(`Error: ${stderr}`);
|
console.error(`Error: ${stderr}`);
|
||||||
throw new Error(`File not found: ${configPath}`);
|
throw new Error(`File not found: ${configPath}`);
|
||||||
}
|
}
|
||||||
const config = parse(stdout) as FileConfig;
|
const config = (parse(stdout) ?? {}) as FileConfig;
|
||||||
return config;
|
return config;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
throw new Error(`File not found: ${configPath}`);
|
throw new Error(`File not found: ${configPath}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user