mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-25 02:32:52 -05:00
add listening on ipv6 addresses
This commit is contained in:
parent
dfef2b862f
commit
6d58d5920e
1 changed files with 8 additions and 4 deletions
12
lib/cli.js
12
lib/cli.js
|
@ -76,6 +76,8 @@ function get_listen_addresses() {
|
|||
}
|
||||
|
||||
addresses = addresses.map(function(addr) {
|
||||
var m
|
||||
|
||||
//
|
||||
// Allow:
|
||||
//
|
||||
|
@ -83,9 +85,11 @@ function get_listen_addresses() {
|
|||
// - localhost:1234 - host + port
|
||||
// - 1234 - port
|
||||
// - http::1234 - protocol + port
|
||||
// - https://localhost:443/ - full url
|
||||
// - https://localhost:443/ - full url + https
|
||||
// - http://[::1]:443/ - ipv6
|
||||
//
|
||||
var m = /^((https?):(\/\/)?)?(([^\/:]+):)?(\d+)\/?$/.exec(addr)
|
||||
// protocol : // ( host )|( ipv6 ): port /
|
||||
var m = /^((https?):(\/\/)?)?((([^\/:]+)|\[([^\[\]]+)\]):)?(\d+)\/?$/.exec(addr)
|
||||
|
||||
if (!m) {
|
||||
logger.logger.warn({ addr: addr },
|
||||
|
@ -97,8 +101,8 @@ function get_listen_addresses() {
|
|||
|
||||
return {
|
||||
proto: m[2] || 'http',
|
||||
host: m[5] || 'localhost',
|
||||
port: m[6] || '4873',
|
||||
host: m[6] || m[7] || 'localhost',
|
||||
port: m[8] || '4873',
|
||||
}
|
||||
}).filter(Boolean)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue