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

chore: rename local option to offline #1850

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module.exports = {
type: 'boolean',
default: false
})
.option('local', {
desc: 'Run commands locally to the daemon',
.option('offline', {
desc: 'Run offline. Do not connect to the rest of the network but provide local API.',
default: false
})
.option('enable-namesys-pubsub', {
Expand Down
10 changes: 5 additions & 5 deletions src/core/components/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ module.exports = function name (self) {
const nocache = options.nocache && options.nocache.toString() === 'true'
const recursive = options.recursive && options.recursive.toString() === 'true'

const local = self._options.local
const offline = self._options.offline

if (!self.isOnline() && !local) {
if (!self.isOnline() && !offline) {
const errMsg = utils.OFFLINE_ERROR

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

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

if (local && nocache) {
const error = 'cannot specify both local and nocache'
if (offline && nocache) {
const error = 'cannot specify both offline and nocache'

log.error(error)
return callback(errcode(new Error(error), 'ERR_NOCACHE_AND_LOCAL'))
return callback(errcode(new Error(error), 'ERR_NOCACHE_AND_OFFLINE'))
}

// Set node id as name for being resolved, if it is not received
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ module.exports = (self) => {
ipnsStores.push(pubsubDs)
}

// DHT should be added as routing if we are not running with local flag
// DHT should be added as routing if we are not running with offline flag
// TODO: Need to change this logic once DHT is enabled by default, for now fallback to Offline datastore
if (get(self._options, 'EXPERIMENTAL.dht', false) && !self._options.local) {
if (get(self._options, 'EXPERIMENTAL.dht', false) && !self._options.offline) {
ipnsStores.push(self.libp2p.dht)
} else {
const offlineDatastore = new OfflineDatastore(self._repo)
Expand Down
2 changes: 1 addition & 1 deletion src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const schema = Joi.object().keys({
Joi.object().keys({ bits: Joi.number().integer() })
).allow(null),
start: Joi.boolean(),
local: Joi.boolean(),
offline: Joi.boolean(),
pass: Joi.string().allow(''),
relay: Joi.object().keys({
enabled: Joi.boolean(),
Expand Down
2 changes: 1 addition & 1 deletion src/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function HttpApi (repo, config, cliArgs) {
init: init,
start: true,
config: config,
local: cliArgs.local,
offline: cliArgs.offline,
pass: cliArgs.pass,
EXPERIMENTAL: {
pubsub: cliArgs.enablePubsubExperiment,
Expand Down
2 changes: 1 addition & 1 deletion test/cli/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('name', () => {
config: {
Bootstrap: []
},
args: ['--pass', passPhrase, '--local'],
args: ['--pass', passPhrase, '--offline'],
initOptions: { bits: 512 }
}, (err, _ipfsd) => {
expect(err).to.not.exist()
Expand Down