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

Commit 8e60322

Browse files
committed
fix: auto init and remove --init flag
1 parent 7a05c3a commit 8e60322

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

src/cli/commands/daemon.js

-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ module.exports = {
1515
builder (yargs) {
1616
return yargs
1717
.epilog(ipfsPathHelp)
18-
.option('init', {
19-
type: 'boolean',
20-
default: false,
21-
desc: 'Initialize ipfs with default settings if not already initialized.'
22-
})
2318
.option('init-config', {
2419
type: 'string',
2520
desc: 'Path to existing configuration file to be loaded during --init.'
@@ -68,7 +63,6 @@ module.exports = {
6863
// Required inline to reduce startup time
6964
const Daemon = require('../../cli/daemon')
7065
const daemon = new Daemon({
71-
init: argv.init,
7266
config,
7367
silent: argv.silent,
7468
repo: process.env.IPFS_PATH,

src/cli/daemon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Daemon {
5555
}
5656

5757
// start the daemon
58-
const ipfsOpts = Object.assign({ }, this._options, { start: true, libp2p })
58+
const ipfsOpts = Object.assign({ }, this._options, { init: true, start: true, libp2p })
5959
const ipfs = new IPFS(ipfsOpts)
6060

6161
await new Promise((resolve, reject) => {

test/cli/daemon.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,6 @@ describe('daemon', () => {
215215
checkLock(repoPath)
216216
})
217217

218-
it('gives error if user hasn\'t run init before', async function () {
219-
this.timeout(100 * 1000)
220-
221-
const err = await ipfs.fail('daemon')
222-
223-
expect(err.stdout).to.include('no initialized ipfs repo found in ' + repoPath)
224-
})
225-
226218
it('should be silent', async function () {
227219
this.timeout(100 * 1000)
228220
await ipfs('init')
@@ -291,9 +283,9 @@ describe('daemon', () => {
291283
}
292284
})
293285

294-
it('should init', async function () {
286+
it('should init by default if not already', async function () {
295287
this.timeout(100 * 1000)
296-
const daemon = ipfs('daemon --init')
288+
const daemon = ipfs('daemon')
297289
let stdout = ''
298290

299291
daemon.stdout.on('data', (data) => {
@@ -315,7 +307,7 @@ describe('daemon', () => {
315307
it('should init with custom config', async function () {
316308
this.timeout(100 * 1000)
317309
const configPath = tempWrite.sync('{"Addresses": {"API": "/ip4/127.0.0.1/tcp/9999"}}', 'config.json')
318-
const daemon = ipfs(`daemon --init --init-config ${configPath}`)
310+
const daemon = ipfs(`daemon --init-config ${configPath}`)
319311

320312
const r = await daemonReady(daemon, () => ipfs('config \'Addresses.API\''))
321313
expect(r).to.be.eq('/ip4/127.0.0.1/tcp/9999\n')

0 commit comments

Comments
 (0)