Skip to main content

Uplinks

An uplink is a link with an external registry that provides access to external packages.

Uplinks

Uso

uplinks:
npmjs:
url: https://registry.npmjs.org/
server2:
url: http://mirror.local.net/
timeout: 100ms
server3:
url: http://mirror2.local.net:9000/
baduplink:
url: http://localhost:55666/

Configuration

You can define mutiple uplinks and each of them must have an unique name (key). They can have the following properties:

PropiedadTipoRequeridoEjemploSoporteDescripciónPor Defecto
urlstringYeshttps://registry.npmjs.org/allEl dominio del registronpmjs
castringNo~./ssl/client.crt'allUbicación del certificado SSLDesactivado
timeoutstringNo100msalltimeout por petición30s
maxagestringNo10mallthe time threshold to the cache is valid2m
fail_timeoutstringNo10malldefine el tiempo máximo cuando una petición falla5m
max_failsnumberNo2alllímite máximo de fallos2
cachebooleanNo[true,false]>= 2.1cache all remote tarballs in storagetrue
authlistNover abajo>= 2.5asigna el encabezado 'Autorización' más informacióndesactivado
headerslistNo]]alllistado de encabezados por uplinkdesactivado
strict_sslbooleanNo[true,false]>= 3.0Es verdadero, requiere que el certificado SSL sea válido.true
agent_optionsobjectNomaxSockets: 10>= 4.0.2options for the HTTP or HTTPS Agent responsible for managing uplink connection persistence and reuse more infoDesactivado

Propiedad auth

La propiedad auth te permite usar un token auth con un uplink. Usando la variable de entorno por defecto:

uplinks:
private:
url: https://private-registry.domain.com/registry
auth:
type: bearer
token_env: true # defaults to `process.env['NPM_TOKEN']`

o a través de una variable de entorno específica:

uplinks:
private:
url: https://private-registry.domain.com/registry
auth:
type: bearer
token_env: FOO_TOKEN

token_env: FOO_TOKEN utilizará internamente process.env['FOO_TOKEN']

o al especificar directamente un token:

uplinks:
private:
url: https://private-registry.domain.com/registry
auth:
type: bearer
token: "token"

Nota: token tiene prioridad sobre token_env

Debes saber

  • Uplinks must be registries compatible with the npm endpoints. Eg: verdaccio, sinopia@1.4.0, npmjs registry, yarn registry, JFrog, Nexus and more.
  • Setting cache to false will help to save space in your hard drive. This will avoid store tarballs but it will keep metadata in folders.
  • Exceed with multiple uplinks might slow down the lookup of your packages due for each request a npm client does, verdaccio does 1 call for each uplink.
  • The (timeout, maxage and fail_timeout) format follow the NGINX measurement units