Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f07e7af

Browse files
committed
feat: Support HTTPS or HTTP service URLs
Fixes pelias/pelias#839
1 parent 5294830 commit f07e7af

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

service.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
'use strict';
2-
31
const http = require('http');
2+
const https = require('https');
43
const request = require('superagent');
54
const _ = require('lodash');
65

@@ -49,8 +48,10 @@ module.exports = function setup(serviceConfig) {
4948

5049
logger.info(`using ${serviceConfig.getName()} service at ${serviceConfig.getBaseUrl()}`);
5150

51+
const connection_library = serviceConfig.getBaseUrl().startsWith('https') ? https : http;
52+
5253
// create one HTTP agent with keep alives enabled per service instance
53-
const agent = new http.Agent({
54+
const agent = new connection_library.Agent({
5455
keepAlive: true
5556
});
5657

0 commit comments

Comments
 (0)