config

package
v1.109.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(baseDir, managerKey string, repoResolve, repoDeploy *string) error

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.

func Path

func Path(baseDir string) string

Types

type Config

type Config struct {
	NPM NPM `json:"npm"`
}

func Load

func Load(baseDir string) (Config, error)

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 NPM

type NPM struct {
	RepoResolve string `json:"repoResolve,omitempty"`
	RepoDeploy  string `json:"repoDeploy,omitempty"`
}

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

func RegistrySettings(gitlabHost, resolveURL, token string) (Settings, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL