Skip to content

Commit 295b1ea

Browse files
committed
feat: Extract cluster server origin from server address
1 parent 723d69c commit 295b1ea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/config_types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as fs from 'fs';
22
import * as _ from 'underscore';
3+
import {URL} from 'url';
34

45
export enum ActionOnInvalid {
56
THROW = 'throw',
@@ -27,7 +28,10 @@ export interface Cluster {
2728
export function newClusters(a: any, opts?: Partial<ConfigOptions>): Cluster[] {
2829
const options = Object.assign(defaultNewConfigOptions(), opts || {});
2930

30-
return _.compact(_.map(a, clusterIterator(options.onInvalidEntry)));
31+
return _.compact(_.map(a, clusterIterator(options.onInvalidEntry))).map((cluster) => ({
32+
...cluster,
33+
server: new URL(cluster.server).origin,
34+
}));
3135
}
3236

3337
export function exportCluster(cluster: Cluster): any {

0 commit comments

Comments
 (0)