mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-21 07:29:37 +01:00
fix zero timeouts in config
This commit is contained in:
parent
df49fb84c1
commit
8af77df0e0
@ -34,14 +34,21 @@ function Storage(config, mainconfig) {
|
||||
_setupProxy.call(this, this.url.hostname, config, mainconfig, this.url.protocol === 'https:')
|
||||
|
||||
this.config.url = this.config.url.replace(/\/$/, '')
|
||||
this.maxage = parse_interval(this.config.maxage || '2m')
|
||||
if (Number(this.config.timeout) >= 1000) {
|
||||
this.logger.warn('Too big timeout value: ' + this.config.timeout + '\nWe changed time format to nginx-like one\n(see http://wiki.nginx.org/ConfigNotation)\nso please update your config accordingly')
|
||||
}
|
||||
this.timeout = parse_interval(this.config.timeout || '30s')
|
||||
this.max_fails = Number(this.config.max_fails) || 2
|
||||
this.fail_timeout = parse_interval(this.config.fail_timeout || '5m')
|
||||
|
||||
// a bunch of different configurable timers
|
||||
this.maxage = parse_interval(config_get('maxage' , '2m' ))
|
||||
this.timeout = parse_interval(config_get('timeout' , '30s'))
|
||||
this.max_fails = Number(config_get('max_fails' , 2 ))
|
||||
this.fail_timeout = parse_interval(config_get('fail_timeout', '5m' ))
|
||||
return this
|
||||
|
||||
// just a helper (`config[key] || default` doesn't work because of zeroes)
|
||||
function config_get(key, def) {
|
||||
return config[key] != null ? config[key] : def
|
||||
}
|
||||
}
|
||||
|
||||
function _setupProxy(hostname, config, mainconfig, isHTTPS) {
|
||||
|
@ -7,6 +7,7 @@ users:
|
||||
uplinks:
|
||||
server1:
|
||||
url: http://localhost:55551/
|
||||
maxage: 0
|
||||
|
||||
logs:
|
||||
- {type: stdout, format: pretty, level: trace}
|
||||
@ -15,7 +16,7 @@ packages:
|
||||
'testfwd':
|
||||
allow_access: all
|
||||
allow_publish: all
|
||||
|
||||
|
||||
'testloop':
|
||||
allow_access: all
|
||||
allow_publish: all
|
||||
|
Loading…
Reference in New Issue
Block a user