8000 Allow environment variables to be used in auth.json · Issue #11746 · composer/composer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow environment variables to be used in auth.json #11746

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

Open
davereid opened this issue Dec 4, 2023 · 4 comments
Open

Allow environment variables to be used in auth.json #11746

davereid opened this issue Dec 4, 2023 · 4 comments
Milestone

Comments

@davereid
Copy link
davereid commented Dec 4, 2023

If I need to rotate my GitHub token or Private Packagist/Artifactory authentication, I would like to do it in one place. NPM supports using environment variables in the .npmrc file but I do not see that Composer also supports it in auth.json files. I propose that we add environment variable support so that I could do the following:

{
    "github-oauth": {
        "github.com": "${GITHUB_TOKEN}"
    },
    "http-basic": {
        "packages.mycompany.com": {
            "username": "first.last@mycompany.com",
            "password": "${PACKAGIST_MY_COMPANY_PASSWORD}"
        }
    }
}

This would allow me to re-use the same variables across Composer and NPM since we use Artifactory for both at the current project I work at, and I only have to update them in once place (my .zshenv file).

@davereid
Copy link
Author
davereid commented Dec 4, 2023

I suppose that I could generate the full COMPOSER_AUTH environment variable too in my .zshenv, but I'd like to have this supported since other package managers support it.

@alcohol
Copy link
Member
alcohol commented Dec 18, 2023

Since we already support COMPOSER_AUTH, I see no motivation to support something else. You can even nest a variable inside said variable.

Supporting ENV variables inside configuration files is not a trivial feature. A pull request could go a lot further than a simple 'request for a change'.

@Seldaek
Copy link
Member
Seldaek commented Dec 19, 2023

Right we do support COMPOSER_AUTH for now that's your best option, you could still define it dynamically in your zshenv using other env vars as input I assume, so that you don't duplicate secrets.

@Seldaek Seldaek added this to the Nice To Have milestone Dec 19, 2023
@Seldaek Seldaek removed the Feature label Jan 22, 2025
@SaberStrat
Copy link

Reference to an older, similar feature request that appeared as a search result (whereas this one here didn't): #6081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@alcohol @davereid @Seldaek @SaberStrat and others
0