brewenv

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = &Environment{
	APIDomain: "https://formulae.brew.sh/api",

	ArtifactDomain:    "",
	APIAutoUpdateSecs: 450,
	AutoUpdateSecs:    86400,

	BottleDomain: "https://ghcr.io/v2/homebrew/core",

	Cache: filepath.Join(xdg.CacheHome, "Homebrew"),

	CleanupMaxAgeDays:       120,
	CleanupPeriodicFullDays: 30,

	Debug:     false,
	Developer: false,

	DockerRegistryBasicAuthToken: "",
	DockerRegistryToken:          "",

	InstallBadge: "🌼",

	NoEmoji: false,

	NoInstallUpgrade:           false,
	NoInstalledDependentsCheck: false,
	NoUpdateReportNew:          false,

	SystemEnvTakesPriority: false,

	Verbose: false,
}

Default is the default values.

Functions

func DefaultEnvironmentFiles

func DefaultEnvironmentFiles() []string

DefaultEnvironmentFiles returns the default files to load the environment config from.

Types

type Environment

type Environment struct {
	// HOMEBREW_PREFIX
	Prefix string `json:"HOMEBREW_PREFIX" env:"HOMEBREW_PREFIX"`

	// HOMEBREW_API_DOMAIN
	// Use this URL as the download mirror for Homebrew JSON API. If metadata files at that URL are temporarily unavailable, the default API domain will be used as a fallback mirror.
	//
	// Default: `https://formulae.brew.sh/api`.
	APIDomain string `json:"HOMEBREW_API_DOMAIN" env:"HOMEBREW_API_DOMAIN"`

	// HOMEBREW_ARTIFACT_DOMAIN
	// Prefix all download URLs, including those for bottles, with this value. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a formula with the URL `https://example.com/foo.tar.gz` to instead download from `http://localhost:8080/https://example.com/foo.tar.gz`. Bottle URLs however, have their domain replaced with this prefix. This results in e.g. `https://ghcr.io/v2/homebrew/core/gettext/manifests/0.21` to instead be downloaded from `http://localhost:8080/v2/homebrew/core/gettext/manifests/0.21`
	ArtifactDomain string `json:"HOMEBREW_ARTIFACT_DOMAIN" env:"HOMEBREW_ARTIFACT_DOMAIN"`

	// HOMEBREW_API_AUTO_UPDATE_SECS
	// Check Homebrew’s API for new formulae or cask data every `HOMEBREW_API_AUTO_UPDATE_SECS` seconds. Alternatively, disable API auto-update checks entirely with `HOMEBREW_NO_AUTO_UPDATE`.
	//
	// Default: `450`.
	APIAutoUpdateSecs int `json:"HOMEBREW_API_AUTO_UPDATE_SECS" env:"HOMEBREW_API_AUTO_UPDATE_SECS"`

	// HOMEBREW_AUTO_UPDATE_SECS
	// Run `brew update` once every `HOMEBREW_AUTO_UPDATE_SECS` seconds before some commands, e.g. `brew install`, `brew upgrade` and `brew tap`. Alternatively, disable auto-update entirely with `HOMEBREW_NO_AUTO_UPDATE`.
	//
	// Default: `86400` (24 hours), `3600` (1 hour) if a developer command has been run or `300` (5 minutes) if `HOMEBREW_NO_INSTALL_FROM_API` is set.
	AutoUpdateSecs int `json:"HOMEBREW_AUTO_UPDATE_SECS" env:"HOMEBREW_AUTO_UPDATE_SECS"`

	// HOMEBREW_BOTTLE_DOMAIN
	// Use this URL as the download mirror for bottles. If bottles at that URL are temporarily unavailable, the default bottle domain will be used as a fallback mirror. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to download from the prefix `http://localhost:8080/`. If bottles are not available at `HOMEBREW_BOTTLE_DOMAIN` they will be downloaded from the default bottle domain.
	//
	// Default: `https://ghcr.io/v2/homebrew/core`.
	BottleDomain string `json:"HOMEBREW_BOTTLE_DOMAIN" env:"HOMEBREW_BOTTLE_DOMAIN"`

	// HOMEBREW_CACHE
	// Use this directory as the download cache.
	//
	// Defaults:
	//  - macOS: `$XDG_CACHE_HOME/Homebrew` or `$HOME/Library/Caches/Homebrew`
	//  - Linux: `$XDG_CACHE_HOME/Homebrew` or `$HOME/.cache/Homebrew`.
	Cache string `json:"HOMEBREW_CACHE" env:"HOMEBREW_CACHE"`

	// HOMEBREW_CLEANUP_MAX_AGE_DAYS
	// Cleanup all cached files older than this many days.
	//
	// Default: `120`.
	CleanupMaxAgeDays int `json:"HOMEBREW_CLEANUP_MAX_AGE_DAYS" env:"HOMEBREW_CLEANUP_MAX_AGE_DAYS"`

	// HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS
	// If set, `brew install`, `brew upgrade` and `brew reinstall` will cleanup all formulae when this number of days has passed.
	//
	// Default: `30`.
	CleanupPeriodicFullDays int `json:"HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS" env:"HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS"`

	// HOMEBREW_DEBUG
	// If set, always assume `--debug` when running commands.
	Debug bool `json:"HOMEBREW_DEBUG" env:"HOMEBREW_DEBUG"`

	// HOMEBREW_DEVELOPER
	// If set, tweak behaviour to be more relevant for Homebrew developers (active or budding) by e.g. turning warnings into errors.
	Developer bool `json:"HOMEBREW_DEVELOPER" env:"HOMEBREW_DEVELOPER"`

	// HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN
	// Use this base64 encoded username and password for authenticating with a Docker registry proxying GitHub Packages. If `HOMEBREW_DOCKER_REGISTRY_TOKEN` is set, it will be used instead.
	DockerRegistryBasicAuthToken string `json:"HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN" env:"HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN"`

	// HOMEBREW_DOCKER_REGISTRY_TOKEN
	// Use this bearer token for authenticating with a Docker registry proxying GitHub Packages. Preferred over `HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN`.
	DockerRegistryToken string `json:"HOMEBREW_DOCKER_REGISTRY_TOKEN" env:"HOMEBREW_DOCKER_REGISTRY_TOKEN"`

	// HOMEBREW_INSTALL_BADGE
	// Print this text before the installation summary of each successful build.
	//
	// Default: The “Beer Mug” emoji.
	InstallBadge string `json:"HOMEBREW_INSTALL_BADGE" env:"HOMEBREW_INSTALL_BADGE"`

	// HOMEBREW_NO_EMOJI
	// If set, do not print `HOMEBREW_INSTALL_BADGE` on a successful build.
	NoEmoji bool `json:"HOMEBREW_NO_EMOJI" env:"HOMEBREW_NO_EMOJI"`

	// HOMEBREW_NO_INSTALL_UPGRADE
	// If set, `brew install` **`formula|cask`** will not upgrade **`formula|cask`** if it is installed but outdated.
	NoInstallUpgrade bool `json:"HOMEBREW_NO_INSTALL_UPGRADE" env:"HOMEBREW_NO_INSTALL_UPGRADE"`

	// HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK
	// If set, do not check for broken linkage of dependents or outdated dependents after installing, upgrading or reinstalling formulae. This will result in fewer dependents (and their dependencies) being upgraded or reinstalled but may result in more breakage from running `brew install` **`formula`** or `brew upgrade` **`formula`**.
	NoInstalledDependentsCheck bool `json:"HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK" env:"HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK"`

	// HOMEBREW_NO_UPDATE_REPORT_NEW
	// If set, `brew update` will not show the list of newly added formulae/casks.
	NoUpdateReportNew bool `json:"HOMEBREW_NO_UPDATE_REPORT_NEW" env:"HOMEBREW_NO_UPDATE_REPORT_NEW"`

	// HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY
	// If set in Homebrew’s system-wide environment file (`/etc/homebrew/brew.env`), the system-wide environment file will be loaded last to override any prefix or user settings.
	SystemEnvTakesPriority bool `json:"HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY" env:"HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY"`

	// HOMEBREW_VERBOSE
	// If set, always assume `--verbose` when running commands.
	Verbose bool `json:"HOMEBREW_VERBOSE" env:"HOMEBREW_VERBOSE"`
}

Environment represents Homebrew's environment configuration. Note that environment variables must have a value set to be detected. For example, run "export HOMEBREW_NO_INSECURE_REDIRECT=1" rather than just "export HOMEBREW_NO_INSECURE_REDIRECT".

`HOMEBREW_*` environment variables can also be set in Homebrew’s environment files:

  • /etc/homebrew/brew.env (system-wide)
  • $HOMEBREW_PREFIX/etc/homebrew/brew.env` (prefix-specific)
  • $XDG_CONFIG_HOME/homebrew/brew.env if $XDG_CONFIG_HOME is set or $HOME/.homebrew/brew.env otherwise (user-specific)

User-specific environment files take precedence over prefix-specific files and prefix-specific files take precedence over system-wide files (unless `HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY` is set, see below).

Note that these files do not support shell variable expansion e.g. `$HOME` or command execution e.g. `$(cat file)`.

func Load

func Load() (*Environment, error)

Load loads the environment config from the OS environment.

func (*Environment) AddGitHubPackagesAuthHeader

func (e *Environment) AddGitHubPackagesAuthHeader(req http.Request)

AddGitHubPackagesAuthHeader adds the GitHub Packages auth header to the request.

func (*Environment) GitHubPackagesAuth

func (e *Environment) GitHubPackagesAuth() string

GitHubPackagesAuth derives the GitHub Packages auth from the env config.

From: https://github.com/Homebrew/brew/blob/master/Library/Homebrew/brew.sh

func (*Environment) String

func (e *Environment) String() string

Jump to

Keyboard shortcuts

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