Skip to content

Commit df0c8d1

Browse files
committed
fix: #64 Error: getaddrinfo ENOTFOUND" on upgrade to 0.12.0
1 parent d143035 commit df0c8d1

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/http/api.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ export class Jira implements IJira {
3434
this.baseUrl = getConfigurationByKey(CONFIG.BASE_URL) || '';
3535

3636
if (this.baseUrl && getGlobalStateConfiguration()) {
37-
const parsedUrl = url.parse(this.baseUrl);
37+
// prepare config for jira-connector
38+
let host = this.baseUrl;
39+
const protocol = host.indexOf('https://') >= 0 ? 'https' : 'http';
40+
host = host.replace('https://', '').replace('http://', '');
41+
const portPosition = host.indexOf(':');
42+
const port = portPosition !== -1 ? host.substring(portPosition + 1) : undefined;
43+
if (portPosition !== -1) {
44+
host = host.substring(0, portPosition);
45+
}
46+
// TODO - manage subfolder
3847
// host from parsedUrl.href because the base url can have subfolder
39-
const host = parsedUrl.href.replace(parsedUrl.protocol + '//', '');
48+
// const host = parsedUrl.href.replace(parsedUrl.protocol + '//', '');
4049
const [username, password] = getGlobalStateConfiguration().split(CREDENTIALS_SEPARATOR);
41-
42-
this.jiraInstance = new jiraClient({
43-
host: host,
44-
port: parsedUrl.port,
45-
protocol: parsedUrl.protocol,
46-
basic_auth: { username, password }
47-
});
50+
this.jiraInstance = new jiraClient({ host, port, protocol, basic_auth: { username, password } });
4851

4952
// custom event
5053
// solve this issue -> https://github.com/floralvikings/jira-connector/issues/115

0 commit comments

Comments
 (0)