Skip to content

Commit e65d90b

Browse files
committed
Moved host:port string manipulation into set_config
1 parent 63d75c9 commit e65d90b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/mixpanel-node.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ var create_client = function(token, config) {
5757

5858
var request_options = {
5959

60-
// Split host, to host and port, for http.get
61-
host: metrics.config.host.split(':')[0],
62-
port: metrics.config.host.split(':')[1] ? metrics.config.host.split(':')[1] : 80,
63-
60+
host: metrics.config.host,
61+
port: metrics.config.port,
6462
headers: {}
6563
};
6664

@@ -690,11 +688,17 @@ var create_client = function(token, config) {
690688
mixpanel client config
691689
*/
692690
metrics.set_config = function(config) {
691+
693692
for (var c in config) {
694693
if (config.hasOwnProperty(c)) {
695694
metrics.config[c] = config[c];
696695
}
697696
}
697+
698+
// Split host, into host and port
699+
metrics.config.port = metrics.config.host.split(':')[1] ? metrics.config.host.split(':')[1] : 80;
700+
metrics.config.host = metrics.config.host.split(':')[0];
701+
698702
};
699703

700704
if (config) {

0 commit comments

Comments
 (0)