Skip to content

Commit

Permalink
feat: support config files (#102)
Browse files Browse the repository at this point in the history
* feat: support config files

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

* feat: update pkg name

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

* feat: do not hardcode pkg name

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

* docs: remove repeated sentence

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias authored and achingbrain committed May 14, 2019
1 parent ac6bfd7 commit 877840b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
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.42.2",
"ipfs-registry-mirror-common": "^1.0.13",
"once": "^1.4.0",
"rc": "^1.2.8",
"request": "^2.88.0",
"request-promise": "^4.2.4",
"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

0 comments on commit 877840b

Please sign in to comment.