feat: limit hosts to enabled regions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-24 16:10:23 +00:00
parent ec7fa92010
commit 2505082a59

View File

@ -133,7 +133,7 @@ impl LNVpsDb for LNVpsDbMysql {
} }
async fn list_hosts(&self) -> Result<Vec<VmHost>> { async fn list_hosts(&self) -> Result<Vec<VmHost>> {
sqlx::query_as("select * from vm_host where enabled = 1") sqlx::query_as("select h.* from vm_host h,vm_host_region hr where h.enabled = 1 and h.region_id = hr.id and hr.enabled = 1")
.fetch_all(&self.db) .fetch_all(&self.db)
.await .await
.map_err(Error::new) .map_err(Error::new)