At the core, I am asking for a pub repository where I can control read access to the packages I make. I need this for my team because we have a handful of private libraries which we cannot/will not open source.
We currently use git dependencies, and while these are adequate, I find the hosted dependency version resolution to be superior.
After some playing around, I see that this presently works:
dependencies:
my_lib:
hosted:
name: my_lib
url: https://username:pass...@myserver.com
The downside to this is the requirement of storing my username and password in my pubspec file, in source control. Plus, it means everyone is going to share the same username and password. If I am going to control access to packages, I really need to have each user be responsible for their own username and password.
Moving on, I considered other alternatives. While digging through the pub source, I found that I can use the “PUB_HOSTED_URL” environment variable to set the pub url. This allows each member of my team to set their credentials in the environment variable and have requests go through my server.
But this has the downside of including passwords in environment variables, and requiring all of my pub traffic to be routed through my pub repo. Either my repo needs to be intelligent enough to mirror the core pub repo, or it will need to act as a proxy and pass calls through when it doesn’t have a packaged.
So those are all of the options I currently see at my disposal. Neither is really great, leading to this discussion.
If I could have my way entirely, I would like to be able to use ssh as the transport mechanism for my private pub store. This might require maintaining static json files which return the data pub get needs, but I have no problem with that.
Assuming using SSH is too complicated, I think Basic HTTP auth is nice middle ground to compromise on. To make it work easily, I think we would need to add a ‘requireAuth’ key in the pubpec:
dependencies:
my_lib:
hosted:
name: my_lib
url: https://myserver.com
requireAuth: true
Then, in some other file, perhaps ~/.pub/authentication.yaml, you would find this:
- url: https://myserver.com
username: johnsmith
password: goteamgo
I figured the authentication lookup would match authentication based upon the url, ensuring credentials only go to the url specfied in the auth file.
Does anyone else have any thoughts or ideas on the matter?
—Danny
At the core, I am asking for a pub repository where I can control read access to the packages I make. I need this for my team because we have a handful of private libraries which we cannot/will not open source.
We currently use git dependencies, and while these are adequate, I find the hosted dependency version resolution to be superior.
Current Options
After some playing around, I see that this presently works:
dependencies: my_lib: hosted: name: my_lib url: https://username:pass...@myserver.comThe downside to this is the requirement of storing my username and password in my pubspec file, in source control. Plus, it means everyone is going to share the same username and password. If I am going to control access to packages, I really need to have each user be responsible for their own username and password.
Moving on, I considered other alternatives. While digging through the pub source, I found that I can use the “PUB_HOSTED_URL” environment variable to set the pub url. This allows each member of my team to set their credentials in the environment variable and have requests go through my server.
But this has the downside of including passwords in environment variables, and requiring all of my pub traffic to be routed through my pub repo.
Either my repo needs to be intelligent enough to mirror the core pub repo, or it will need to act as a proxy and pass calls through when it doesn’t have a packaged.
So those are all of the options I currently see at my disposal. Neither is really great, leading to this discussion.
Ideal Solution
If I could have my way entirely, I would like to be able to use ssh as the transport mechanism for my private pub store. This might require maintaining static json files which return the data pub get needs, but I have no problem with that.
Proposed Solution
Assuming using SSH is too complicated, I think Basic HTTP auth is nice middle ground to compromise on. To make it work easily, I think we would need to add a ‘requireAuth’ key in the pubpec:
dependencies: my_lib: hosted: name: my_lib url: https://myserver.com requireAuth: true
Then, in some other file, perhaps
~/.pub/authentication.yaml, you would find this:- url: https://myserver.com username: johnsmith password: goteamgoI figured the authentication lookup would match authentication based upon the url, ensuring credentials only go to the url specfied in the auth file.
Does anyone else have any thoughts or ideas on the matter?
On Thu, Jan 29, 2015 at 9:55 PM, Danny Kirchmeier <da...@kirchmeier.us> wrote:At the core, I am asking for a pub repository where I can control read access to the packages I make. I need this for my team because we have a handful of private libraries which we cannot/will not open source.
Understandable. A number of users have asked to be able to run their own pub repository. From pub's perspective, you're more than welcome to do so. We just haven't implemented a reusable pub server that doesn't run on AppEngine. But, as long as you speak the same dead simple HTTP API that the pub client expects, it's pretty straightforward to write one yourself.
We (the pub team) never have because it's not something we can prioritize at Google but I've always hoped some fine upstanding community members would take it upon themselves to write a reusable one and share it with the rest of the world. Hint hint. ;)We currently use git dependencies, and while these are adequate, I find the hosted dependency version resolution to be superior.
Totally.
Current Options
After some playing around, I see that this presently works:
dependencies: my_lib: hosted: name: my_lib url: https://username:password@myserver.com
The downside to this is the requirement of storing my username and password in my pubspec file, in source control. Plus, it means everyone is going to share the same username and password. If I am going to control access to packages, I really need to have each user be responsible for their own username and password.
Worse, in my opinion, is that you have to add that URL to every dependency in all of your transitive dependencies' pubspecs.Moving on, I considered other alternatives. While digging through the pub source, I found that I can use the “PUB_HOSTED_URL” environment variable to set the pub url. This allows each member of my team to set their credentials in the environment variable and have requests go through my server.
I could have sworn we documented PUB_HOSTED_URL somewhere, but now I can't find it. Yes, this is the better way to point pub at a different server. Sorry you had to dig through code to find it.
There is work to rebuild our pub site on Dart and the implementation contains a separate package with support for the pub HTTP protocol. You'll have to wire in your own storage, but you'll be using the same server code that the pub site uses.There isn't a timeline on this work, but know it's coming.
Is there any way that we can help speed this along?
a) Using pub with private package repositoryAs you have found out, there are a number of built-in assumptions, which are reflected in the (not yet officially documented) API used for communication between the pub client and the pub server. Namely the pub client:- requires you to basically have a gmail account and requires you to grant it oauth2 access (to get your email address)- the uploading protocol is a 3 step process which was required to upload to google cloud storage directly from the client- it communicates with pub.dartlang.org (possibly adding the Authorization header which can be used to retrieve the uploader's email address)- it uses HTTP as protocolThis has the implication that neither authorization nor transport protocol is plugable.=> This is a limitation is in the pub client and there might be several ways of making these two things plugable. AFAIK we haven't seen demand for this so far, but it wouldn't hurt filing a feature request for the pub client (feel free to create a bug at http://dartbug.com/new with Area=Pub).
At the core, I am asking for a pub repository where I can control read access to the packages I make. I need this for my team because we have a handful of private libraries which we cannot/will not open source.
We currently use git dependencies, and while these are adequate, I find the hosted dependency version resolution to be superior.
Current Options
After some playing around, I see that this presently works:
dependencies: my_lib: hosted: name: my_lib url: https://username:password@myserver.com
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
I see a "dartdoc" placeholder was just added to pub. Any chance we can get a 0.1.0 release soon so that I can start to integrate it? Looks like just what I need.
--