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

Commit bbe561b

Browse files
vasco-santosAlan Shaw
authored and
Alan Shaw
committed
chore: rename local option to offline (#1850)
BREAKING CHANGE: `--local` option has been renamed to `--offline`
1 parent 3cfeda9 commit bbe561b

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

src/cli/commands/daemon.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ module.exports = {
2626
type: 'boolean',
2727
default: false
2828
})
29-
.option('local', {
30-
desc: 'Run commands locally to the daemon',
29+
.option('offline', {
30+
desc: 'Run offline. Do not connect to the rest of the network but provide local API.',
3131
default: false
3232
})
3333
.option('enable-namesys-pubsub', {

src/core/components/name.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ module.exports = function name (self) {
129129
const nocache = options.nocache && options.nocache.toString() === 'true'
130130
const recursive = options.recursive && options.recursive.toString() === 'true'
131131

132-
const local = self._options.local
132+
const offline = self._options.offline
133133

134-
if (!self.isOnline() && !local) {
134+
if (!self.isOnline() && !offline) {
135135
const errMsg = utils.OFFLINE_ERROR
136136

137137
log.error(errMsg)
@@ -140,11 +140,11 @@ module.exports = function name (self) {
140140

141141
// TODO: params related logic should be in the core implementation
142142

143-
if (local && nocache) {
144-
const error = 'cannot specify both local and nocache'
143+
if (offline && nocache) {
144+
const error = 'cannot specify both offline and nocache'
145145

146146
log.error(error)
147-
return callback(errcode(new Error(error), 'ERR_NOCACHE_AND_LOCAL'))
147+
return callback(errcode(new Error(error), 'ERR_NOCACHE_AND_OFFLINE'))
148148
}
149149

150150
// Set node id as name for being resolved, if it is not received

src/core/components/start.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ module.exports = (self) => {
6767
ipnsStores.push(pubsubDs)
6868
}
6969

70-
// DHT should be added as routing if we are not running with local flag
70+
// DHT should be added as routing if we are not running with offline flag
7171
// TODO: Need to change this logic once DHT is enabled by default, for now fallback to Offline datastore
72-
if (get(self._options, 'EXPERIMENTAL.dht', false) && !self._options.local) {
72+
if (get(self._options, 'EXPERIMENTAL.dht', false) && !self._options.offline) {
7373
ipnsStores.push(self.libp2p.dht)
7474
} else {
7575
const offlineDatastore = new OfflineDatastore(self._repo)

src/core/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const schema = Joi.object().keys({
1818
Joi.object().keys({ bits: Joi.number().integer() })
1919
).allow(null),
2020
start: Joi.boolean(),
21-
local: Joi.boolean(),
21+
offline: Joi.boolean(),
2222
pass: Joi.string().allow(''),
2323
relay: Joi.object().keys({
2424
enabled: Joi.boolean(),

src/http/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function HttpApi (repo, config, cliArgs) {
8181
init: init,
8282
start: true,
8383
config: config,
84-
local: cliArgs.local,
84+
offline: cliArgs.offline,
8585
pass: cliArgs.pass,
8686
EXPERIMENTAL: {
8787
pubsub: cliArgs.enablePubsubExperiment,

test/cli/name.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('name', () => {
3636
config: {
3737
Bootstrap: []
3838
},
39-
args: ['--pass', passPhrase, '--local'],
39+
args: ['--pass', passPhrase, '--offline'],
4040
initOptions: { bits: 512 }
4141
}, (err, _ipfsd) => {
4242
expect(err).to.not.exist()

0 commit comments

Comments
 (0)