Clarified address regex

This commit is contained in:
murgatroid99 2015-08-12 11:54:41 -07:00
parent 7970af5e1b
commit 02b7005b49
1 changed files with 2 additions and 2 deletions

View File

@ -548,8 +548,8 @@ exports.makeClientConstructor = function(methods, serviceName) {
}
options['grpc.primary_user_agent'] = 'grpc-node/' + version;
this.channel = new grpc.Channel(address, credentials, options);
// Extract the DNS name from the address string
address = address.replace(/(\w+:\/\/+)?([^:]+)(:\d+)?\/?$/, '$2');
// Remove the optional DNS scheme, trailing port, and trailing backslash
address = address.replace(/^(dns:\/{3})?([^:\/]+)(:\d+)?\/?$/, '$2');
this.server_address = address;
this.auth_uri = 'https://' + this.server_address + '/' + serviceName;
this.updateMetadata = updateMetadata;