Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Merge ¶
Merge updates the block named managerKey in the config file, setting only the non-nil fields, and leaves all other manager blocks and unknown keys intact. Merge is intentionally generic: it does not know which fields a given manager supports. Callers are responsible for passing only applicable fields — for example, a manager that cannot deploy through the firewall passes a nil repoDeploy.
Types ¶
type Config ¶
type Config struct {
NPM NPM `json:"npm"`
}
func Load ¶
Load reads .gitlab/df/config.json under baseDir. A missing file is not an error: it returns the zero-value Config so callers treat "no config yet" as empty defaults (the first `glab dependency-firewall <manager> config` call on a repo hits this path). Any other read or unmarshal failure is returned.
type Settings ¶
type Settings struct {
// RegistryURL is the full https URL package managers should resolve
// against, with a trailing slash.
RegistryURL string
// AuthHost is the "host + path" portion of RegistryURL, used by npm-
// style config files that scope credentials by URL prefix (for
// example, //gitlab.example/api/v4/projects/42/packages/npm/:_authToken).
AuthHost string
// AuthToken is the GitLab token to send to the registry, or empty
// when the registry host does not match the logged-in GitLab host.
// The empty case is deliberate: it keeps the token out of requests
// to third-party or public registries.
AuthToken string
}
Settings is the registry connection information every package manager needs to route traffic through the firewall. It is populated by RegistrySettings and consumed by both the manager-specific config writers (npmrc today; later stack slices add yarnrc, pip, maven, …) and by the pm.Run wrapper.
func RegistrySettings ¶
RegistrySettings builds the Settings for resolveURL, a full registry URL. The GitLab token is attached only when the registry host matches the logged-in GitLab host, so the token is never sent to a third-party (for example, public) registry. The returned settings are shared by all package managers.