mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-06 21:57:48 +01:00
Enhancement: support multiple proxmox nodes (#5539)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
@@ -24,9 +24,28 @@ export default async function handler(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
const baseUrl = `${proxmoxConfig.url}/api2/json`;
|
||||
// Prefer per-node config (new format), fall back to legacy flat creds.
|
||||
const nodeConfig =
|
||||
(node && proxmoxConfig && proxmoxConfig[node]) ||
|
||||
(proxmoxConfig && proxmoxConfig.url && proxmoxConfig.token && proxmoxConfig.secret
|
||||
? {
|
||||
url: proxmoxConfig.url,
|
||||
token: proxmoxConfig.token,
|
||||
secret: proxmoxConfig.secret,
|
||||
}
|
||||
: null);
|
||||
|
||||
if (!nodeConfig) {
|
||||
return res.status(400).json({
|
||||
error:
|
||||
"Proxmox config not found for the specified node and no legacy credentials detected. " +
|
||||
"Add a node block in proxmox.yaml (e.g., 'pve: { url, token, secret }') or restore legacy top-level url/token/secret.",
|
||||
});
|
||||
}
|
||||
|
||||
const baseUrl = `${nodeConfig.url}/api2/json`;
|
||||
const headers = {
|
||||
Authorization: `PVEAPIToken=${proxmoxConfig.token}=${proxmoxConfig.secret}`,
|
||||
Authorization: `PVEAPIToken=${nodeConfig.token}=${nodeConfig.secret}`,
|
||||
};
|
||||
|
||||
const statusUrl = `${baseUrl}/nodes/${node}/${vmType}/${vmid}/status/current`;
|
||||
|
||||
Reference in New Issue
Block a user