Can I use environment or config variables in dependency git URL


(Mike Preisinger) #1

I’ve Googled on this quite a bit but I’m coming up empty. I’m trying to have a protected dependency linked to as a git URL but don’t want to hard-code the password. I’d like to use an environment variable, but that doesn’t seem to work.

For example, instead of…

"dependencies": {
	"my-private-module": "git+https://node-module-user:sup3r-s3cr3t-k3y@my-git-server.local/my-private-module.git"
} 

… I’d like to do …

"dependencies": {
    "my-private-module": "git+https://node-module-user:$node_module_key@my-git-server.local/my-private-module.git"
}

Unfortunately, npm install doesn’t seem to recognize environment variables in this context. Is there any way to do this?

Thanks!


(system) #2

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.