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

feat: support config files #102

Merged
merged 4 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,15 @@ Options:
unavailable
[default: "https://registry.npmjs.com"]
```

## Configuration File

We use [`rc`](https://github.com/dominictarr/rc) to parse configuration files. Please see the [`rc` repository](https://github.com/dominictarr/rc#standards) for the order of precedence used when searching for configuration files. Our app is `ipfs-npm`.

For instance, if you want to always use a remote daemon, you could create a `~/.ipfs-npmrc` file like this:

```json
{
"ipfsNode": "/ip4/127.0.0.1/tcp/5001"
}
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"ipfsd-ctl": "~0.40.1",
"ipfs-registry-mirror-common": "^1.0.13",
"once": "^1.4.0",
"rc": "^1.2.8",
"request": "^2.88.0",
"request-promise": "^4.2.2",
"which-promise": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ require('dnscache')({ enable: true })
const pkg = require('../../package')
const path = require('path')
const os = require('os')
const rc = require('rc')

process.title = pkg.name

const yargs = require('yargs')
.config(rc(pkg.name, null, {}))

yargs.command('$0', 'Installs your js dependencies using IPFS', (yargs) => { // eslint-disable-line no-unused-expressions
yargs
Expand Down