@yolo-croket-dev/core 1.9.7 → 1.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/util.js +7 -2
package/package.json
CHANGED
package/util.js
CHANGED
|
@@ -10,8 +10,13 @@ function generateRandom(length, charset) {
|
|
|
10
10
|
}
|
|
11
11
|
exports.generateRandom = generateRandom;
|
|
12
12
|
/** host에서 port를 추출합니다. */
|
|
13
|
+
// ex) dns://user-service.croket.svc.cluster.local:50051 => 50051
|
|
14
|
+
// ex) localhost:50051 => 50051
|
|
13
15
|
function getPortFromHost(host) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
+
const specificHost = host.includes('://') ? host.split('://')[1] : host;
|
|
17
|
+
if (specificHost.includes(':' && specificHost.split(':')[1])) {
|
|
18
|
+
return parseInt(specificHost.split(':')[1], 10);
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
16
21
|
}
|
|
17
22
|
exports.getPortFromHost = getPortFromHost;
|