Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #416 from ipfs/fix/init
Browse files Browse the repository at this point in the history
fix(repo): init does not break if no opts are passed. Fixes #349
  • Loading branch information
daviddias authored Aug 15, 2016
2 parents 7dcff81 + ca700cc commit bd842f9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/ipfs/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ const Importer = require('ipfs-unixfs-engine').importer

module.exports = function init (self) {
return (opts, callback) => {
opts = opts || {}
if (typeof opts === 'function') {
callback = opts
opts = {}
}

opts.emptyRepo = opts.emptyRepo || false
opts.bits = opts.bits || 2048

// Pre-set config values.
var config = JSON.parse(fs.readFileSync(path.join(__dirname, '../../init-files/default-config.json')).toString())
const config = JSON.parse(fs.readFileSync(path.join(__dirname, '../../init-files/default-config.json')).toString())

// Verify repo does not yet exist.
self._repo.exists((err, exists) => {
Expand Down

0 comments on commit bd842f9

Please sign in to comment.