Skip to content

Commit 229d855

Browse files
committed
fix: allow provisioning to update ip_list + allow setting some fields to null
1 parent bdf0563 commit 229d855

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/provisioning.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ import { Server } from './models/server';
88
// Provisioning has a couple edgecases:
99
// - It will only update existing entries, will not add new one
1010
// - Only the fields in the below schema will be updated
11+
// - Set fields to null to unset them. Undefined means it won't be modified
1112

1213
const serverProvisioningSchema = z.object({
1314
servers: z.array(z.object({
1415
id: z.string(),
1516
name: z.string(),
16-
ip: z.string().optional(),
17-
ipList: z.array(z.string()).optional(),
18-
port: z.coerce.number(),
19-
health_check_port: z.coerce.number().optional()
17+
ip: z.string().nullable().optional(),
18+
ip_list: z.array(z.string()).default([]),
19+
port: z.number(),
20+
health_check_port: z.number().nullable().optional()
2021
}))
2122
});
2223

@@ -42,7 +43,7 @@ export async function handleServerProvisioning(): Promise<void> {
4243
$set: {
4344
_id: id,
4445
service_name: server.name,
45-
ipList: server.ipList,
46+
ip_list: server.ip_list,
4647
ip: server.ip,
4748
port: server.port,
4849
health_check_port: server.health_check_port

0 commit comments

Comments
 (0)