@@ -8,15 +8,17 @@ 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
1213const serverProvisioningSchema = z . object ( {
1314 servers : z . array ( z . object ( {
1415 id : z . string ( ) ,
15- 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 ( )
16+ name : z . string ( ) . optional ( ) ,
17+ ip : z . string ( ) . nullable ( ) . optional ( ) ,
18+ ip_list : z . array ( z . string ( ) ) . optional ( ) ,
19+ port : z . number ( ) . optional ( ) ,
20+ health_check_port : z . number ( ) . nullable ( ) . optional ( ) ,
21+ aes_key : z . string ( ) . optional ( )
2022 } ) )
2123} ) ;
2224
@@ -42,10 +44,11 @@ export async function handleServerProvisioning(): Promise<void> {
4244 $set : {
4345 _id : id ,
4446 service_name : server . name ,
45- ipList : server . ipList ,
47+ ip_list : server . ip_list ,
4648 ip : server . ip ,
4749 port : server . port ,
48- health_check_port : server . health_check_port
50+ health_check_port : server . health_check_port ,
51+ aes_key : server . aes_key
4952 }
5053 } ) ;
5154 if ( ! result ) {
0 commit comments