Skip to content

Commit

Permalink
Merge pull request #14 from serapath-contribution/master
Browse files Browse the repository at this point in the history
UPDATE hyperdrive opts.storage to initialize with given location
  • Loading branch information
RangerMauve authored Aug 19, 2019
2 parents f20777f + 754c22f commit 5883050
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function SDK ({ storageOpts, swarmOpts, driveOpts, coreOpts, dnsOpts } = {}) {

let driveStorage = null
try {
driveStorage = persist ? opts.storage || storage.getDrive(location) : RAM
driveStorage = persist ? opts.storage(location) || storage.getDrive(location) : RAM
} catch (e) {
if (e.message !== 'Unable to create storage') throw e

Expand All @@ -104,7 +104,7 @@ function SDK ({ storageOpts, swarmOpts, driveOpts, coreOpts, dnsOpts } = {}) {
location = DatEncoding.encode(publicKey)
opts.secretKey = secretKey

driveStorage = persist ? opts.storage || storage.getDrive(location) : RAM
driveStorage = persist ? opts.storage(location) || storage.getDrive(location) : RAM
}

const drive = hyperdrive(driveStorage, key, opts)
Expand Down

0 comments on commit 5883050

Please sign in to comment.