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

read additional registry URLs from DUB_REGISTRY env var #1173

Merged
merged 1 commit into from
Jun 26, 2017

Conversation

MartinNowak
Copy link
Member

  • multiple URLs separated by semicolon

@dlang-bot
Copy link
Collaborator

Thanks for your pull request, @MartinNowak!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 61.698% when pulling 66f00a6 on MartinNowak:env_registry_urls into 11ed829 on dlang:master.

@MartinNowak
Copy link
Member Author

Can you change the settings of Coveralls to not leave comments btw?
https://coveralls.io/github/dlang/dub/settings

@s-ludwig
Copy link
Member

Can you change the settings of Coveralls to not leave comments btw?

Done.

@@ -257,6 +257,7 @@ struct CommonOptions {
/// Parses all common options and stores the result in the struct instance.
void prepare(CommandArgs args)
{
registry_urls = environment.get("DUB_REGISTRY", null).split(";");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should rather be done in the Dub class, so that the command line module ideally performs pure command line parsing (I realize that it already reads DFLAGS, which should really be refactored). A new mode for SkipPackageSuppliers could then also be added to enable choosing between using only those specified on the command line, or also those coming from the environment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird to pass package suppliers to new Dub only to have it add more package suppliers internally.
Also the env variables are simple alternatives to the command line options, so treating them somewhere else doesn't seem too sensible.

Copy link
Member Author

@MartinNowak MartinNowak Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add env var support to CommandArgs or do sth. similar, if a more structured approach seems appropriate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird to pass package suppliers to new Dub only to have it add more package suppliers internally.

But it will add more anyway, the default one and the ones from the config file. Also, Dub already reads DUBPATH for example. So just based on the current state, adding it there would cause a bit less additional confusion - but in general I'd say all of this should be controllable from outside of the Dub class and a more principled separation would of course be even better.

Adding a generic way to handle env vars as an alternative to certain command line arguments also open up the possibility for better auto-generated command line help, so that sounds like a good idea. The only thing that should be there, and this is kind of orthogonal to this PR, is a way to pass a custom environment, so that it's possible to opt-out when the package is used as a library. This actually applies to the whole library, though, and not just to the command line module.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, makes sense to move to dub.d then. Abstracting out environment could indeed make sense, but having a library react to env vars has it's use-case as well (e.g. CURL).

- multiple URLs separated by semicolon
@s-ludwig
Copy link
Member

Okay, I've opened two issues to remember this.

@dlang-bot dlang-bot merged commit f7819a8 into dlang:master Jun 26, 2017
@MartinNowak MartinNowak deleted the env_registry_urls branch June 27, 2017 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants