diff --git a/README.md b/README.md index d0811493..ccd8398c 100644 --- a/README.md +++ b/README.md @@ -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" +} +``` diff --git a/package.json b/package.json index 3aeb2a3a..fd9ae6fe 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/cli/bin.js b/src/cli/bin.js index 112a437b..0f3348f2 100755 --- a/src/cli/bin.js +++ b/src/cli/bin.js @@ -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