-
Notifications
You must be signed in to change notification settings - Fork 36
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
Added support for PERL_CPM_MIRROR to set default mirror #205
base: main
Are you sure you want to change the base?
Conversation
Oh, and the tests run fine locally by the way, but your approval @skaji is required to get the Github actions to run. |
Thanks for the PR. |
Will |
I'm not sure yet. |
Would you be open to accepting this pull request until such time as there is a set timeline for |
Just out of curiosity, why do you want to change mirror? |
Two main reasons:
|
OK, thanks.
Then I recommend you to use --resolver, not --mirror. |
Does resolver support being set through an environment variable? I can't seem to see any trace of this in the current code. The main purpose of this pull request is being able to not specify mirror / resolver on every invocation of For To reiterate:
But to change things around: what is your main concern in accepting support for this? And is there anything I can change in the pull request so that your concerns are addressed? |
Just wanted to follow up on this. Is there no interest in being able to set parameters through environment variables like this merge request enables? |
I have a plan to deprecate --mirror option, so I don't want to add a new feature around mirror. |
Are you open to getting support for letting resolvers be set by env-variables? If so I am more than happy to change this merge request so that mirror is not changed but resolvers get the added functionality. |
Adding the environment variable
$ENV{PERL_CPM_MIRROR}
so that it is possible to set a mirror without invokingcpm
directly with--mirror
.A specific usecase for this:
You create a base docker image where you have
PERL_CPM_MIRROR
set to a sensible default value (other than metacpan.org). Containers based on this image picks that up automatically, so that a developer just runningcpm install ...
in theirDockerfile
will get packages pulled from the correct repository. This is especially useful in environments where you have many images that are based on one base image and you would like to avoid duplication of urls. If the url needs to change you can do that once and not have to go through all Dockerfiles and change them like you would have to if everyone was forced to specify--mirror
.This change is however not limited to the above usecase. It also makes it convenient to do a quick
export PERL_CPM_MIRROR=...
in your environment and from that point on not have to remember to runcpm
with--mirror
all the time.I've made the change in such a way that
--mirror
always has precedence if specified on the commandline, with a fallback to$ENV[PERL_CPM_MIRROR
if set, or lastlyhttps://cpan.metacpan.org
as a last resort.