Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring Homebrew with .env files #15787

Merged
merged 1 commit into from
Aug 1, 2023
Merged

Allow configuring Homebrew with .env files #15787

merged 1 commit into from
Aug 1, 2023

Commits on Jul 28, 2023

  1. Allow configuring Homebrew with .env files

    For a long time people have requested some sort of configuration files
    for Homebrew. Now: here's the first version of that.
    
    Similarly to how you can configure Git for a system, a repository or
    a user: you can configure Homebrew for a system, a prefix or a user.
    
    The system-wide configuration file is `/etc/homebrew/brew.env`, the
    prefix-specific configuration file is
    `$HOMEBREW_PREFIX/etc/homebrew/brew.env`
    and the user-specific configuration file is `~/.homebrew/brew.env`.
    
    As we need to read these files from Bash in `bin/brew` (so they can)
    influence functionality ASAP: they are in a simple format that Bash
    can read. It may be that we have more complex array or hash data in
    future that's configured through JSON or YAML (most likely JSON as we
    use it more) and stored in a `brew.json`/`brew.yaml` file in the same
    directory.
    
    As this is relying on `eval` in Bash which is fairly dangerous: we
    filter the lines with a regex to ensure we're only permitting setting
    `HOMEBREW_*` variables and nothing more.
    
    To give a bit of power to system administrators, the
    `HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY` variable can be set in
    `/etc/homebrew/brew.env` to ensure that the system-wide configuration
    file is loaded last and overrides any prefix or user settings.
    
    Now that we have an actual location for configuration files, let's also
    change the `brew livecheck` watchlist configuration file to be in this
    directory and deprecate the existing location. As this is a developer
    command and the mitigation is to just move the file: we don't need to
    follow the normal deprecation process here.
    MikeMcQuaid committed Jul 28, 2023
    Configuration menu
    Copy the full SHA
    375a7ee View commit details
    Browse the repository at this point in the history