Skip to content

Commit

Permalink
feat: add KUBO_BINARY env to allow overriding the path used (#62)
Browse files Browse the repository at this point in the history
Refs: ipfs/kubo#10013

---------

Co-authored-by: Alex Potsides <alex@achingbrain.net>
  • Loading branch information
Jorropo and achingbrain committed Aug 1, 2023
1 parent f8af841 commit 4441b8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ An error will be thrown if the path to the binary cannot be resolved.

Downloaded archives are placed in OS-specific cache directory which can be customized by setting `NPM_GO_IPFS_CACHE` in env.

### Overriding with `KUBO_BINARY` env

If the `KUBO_BINARY` env variable is set at runtime this will override the path of the binary used.

This must point to the file, not the directory containing the file.

## Development

**Warning**: the file `bin/ipfs` is a placeholder, when downloading stuff, it gets replaced. so if you run `node install.js` it will then be dirty in the git repo. **Do not commit this file**, as then you would be commiting a big binary and publishing it to npm. A pre-commit hook exists and should protect against this, but better safe than sorry.
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const fs = require('fs')
const path = require('path')

module.exports.path = function () {
if (process.env.KUBO_BINARY) {
return process.env.KUBO_BINARY
}

const paths = [
path.resolve(path.join(__dirname, '..', 'go-ipfs', 'ipfs')),
path.resolve(path.join(__dirname, '..', 'go-ipfs', 'ipfs.exe'))
Expand Down

0 comments on commit 4441b8a

Please sign in to comment.