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

Commit

Permalink
fix(repo): init does not break if no opts are passed. Fixes #349
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 15, 2016
1 parent 7dcff81 commit ca700cc
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 ca700cc

Please sign in to comment.