From 3fddcda3393f2ab4b19b4564fefe6caea21f31e8 Mon Sep 17 00:00:00 2001 From: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Date: Wed, 19 Oct 2022 07:02:32 +0200 Subject: [PATCH] docs(configuration options): explain short vs long host names for matchHost (#16928) Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: Rhys Arkins <rhys@arkins.net> --- docs/usage/configuration-options.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 239f20d4db..c19f6c28a7 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -1206,6 +1206,25 @@ If the value starts with `http(s)` then it will only match against URLs which st Otherwise, it will be matched by checking if the URL's hostname matches the `matchHost` directly or ends with it. When checking the end of the hostname, a single dot is prefixed to the value of `matchHost`, if one is not already present, to ensure it can only match against whole domain segments. +The `matchHost` URL must be the same as the `registryUrl` set in `.npmrc`, or you'll get authentication issues when the artifacts are updated when yarn or npm runs. + +```json +{ + "hostRules": [ + { + "matchHost": "https://gitlab.myorg.com/api/v4/packages/npm/", + "token": "abc123" + } + ] +} +``` + +The above corresponds with an `.npmrc` like the following: + +``` +registry=https://gitlab.myorg.com/api/v4/packages/npm/ +``` + <!-- prettier-ignore --> !!! note Values containing a URL path but missing a scheme will be prepended with 'https://' (e.g. `domain.com/path` -> `https://domain.com/path`) -- GitLab