mirror of https://github.com/grpc/grpc-node.git
node.cluster is optional in the bootstrap file
This commit is contained in:
parent
0e8e1adfc4
commit
7e35657cf1
|
|
@ -157,15 +157,6 @@ function validateNode(obj: any): Node {
|
|||
throw new Error(`node.id field: expected string, got ${typeof obj.id}`);
|
||||
}
|
||||
result.id = obj.id;
|
||||
if (!('cluster' in obj)) {
|
||||
throw new Error('cluster field missing in node element');
|
||||
}
|
||||
if (typeof obj.cluster !== 'string') {
|
||||
throw new Error(
|
||||
`node.cluster field: expected string, got ${typeof obj.cluster}`
|
||||
);
|
||||
}
|
||||
result.cluster = obj.cluster;
|
||||
if (!('locality' in obj)) {
|
||||
throw new Error('locality field missing in node element');
|
||||
}
|
||||
|
|
@ -197,6 +188,14 @@ function validateNode(obj: any): Node {
|
|||
}
|
||||
result.locality.sub_zone = obj.locality.sub_zone;
|
||||
}
|
||||
if ('cluster' in obj) {
|
||||
if (typeof obj.cluster !== 'string') {
|
||||
throw new Error(
|
||||
`node.cluster field: expected string, got ${typeof obj.cluster}`
|
||||
);
|
||||
}
|
||||
result.cluster = obj.cluster;
|
||||
}
|
||||
if ('metadata' in obj) {
|
||||
result.metadata = getStructFromJson(obj.metadata);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue