Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/porsager/env-install
Use environment variables in npm dependencies paths
https://github.com/porsager/env-install
Last synced: about 2 months ago
JSON representation
Use environment variables in npm dependencies paths
- Host: GitHub
- URL: https://github.com/porsager/env-install
- Owner: porsager
- Created: 2016-12-06T22:24:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-03T18:19:12.000Z (over 5 years ago)
- Last Synced: 2024-07-02T08:10:43.154Z (3 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 16
- Watchers: 3
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# env-install
Using private git repositories that requires authentication is often necessary when running npm install, but you don't want to put keys, tokens or passwords in your code, so instead you can use this module that allows you to define packages with environment variable names to inject your keys, passwords or tokens.
## Usage
Add this module as a dependency in your projects normal dependencies, and add a `postinstall` script that contains `env-install`.
Then declare your dependencies containing environment variables in `envDependencies````
scripts: {
"postinstall": "env-install"
},
dependencies: {
"env-install": "1.0.0"
},
envDependencies: {
"some-secret-module": "git+https://${GITHUB_TOKEN}:[email protected]/you/privaterepo"
}
```In the above example `some-secret-module` will be installed like this:
```
GITHUB_TOKEN=abcdefg123456
npm install https://abcdefg123456:[email protected]/you/privaterepo
```