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

fix(repo): init does not break if no opts are passed. Fixes #349 #416

Merged
merged 1 commit into from
Aug 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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