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

how to deal with npm credentials #5

Open
pszabop opened this issue Apr 19, 2018 · 2 comments
Open

how to deal with npm credentials #5

pszabop opened this issue Apr 19, 2018 · 2 comments

Comments

@pszabop
Copy link

pszabop commented Apr 19, 2018

Can you think of a better way to deal with npm credentials? They need to be saved across invocations.

This is what I came up with:

bin/npm --userconfig=./.npmuser adduser

and I have to specify --userconfig every time I need to use NPM's credentials. Which is annoying.

@mterrel
Copy link
Member

mterrel commented Apr 19, 2018

No, I've had exactly the same complaint when I publish. But I've only needed to do that infrequently so far, so haven't spent time on a good solution. I don't think that pulling in credentials from the user's home directory by default would be the right answer, but an explicit opt-in via environment variable to do that might be OK.
If you have any better solutions for the credentials problem, please feel free to suggest ideas.

@mvachhar
Copy link
Contributor

The fix for this, that I haven't gotten around to implementing, and would love a pull request for, is to allow the config file for a container (the node file in the docs) to specify extra command line arguments for both the command inside npm and for docker. The trick is to make this work nicely with extra arguments or DOCKER_ARGS specified on the command line itself.

You could then stack things by doing something like the following for your ./bin/npm file

#!/usr/bin/env bash
EXTRA_DOCKER_ARGS = -v~/.npmuser:/src/.npmuser
EXTRA_ARGS = --userconfig=/src/.npmuser
. <path to command file>/node

Of course, this is shell, so getting the quoting and paths right will be way harder than it needs to be but that is the price of portability.

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

3 participants