RangerMauve / dat-store

A CLI tool for backing up hyperdrive datasets
GNU Affero General Public License v3.0
59 stars 14 forks source link

how to set provider ? #19

Closed eyun-tv closed 5 years ago

eyun-tv commented 5 years ago

image

eyun-tv commented 5 years ago

And how to use multiple providers ? there is a example ?

RangerMauve commented 5 years ago

Hi! There's an example a the top of the README:

# Configure external storage provider
dat-store set-provider hashbase https://hashbase.io/
dat-store login hashbase yourusername
dat-store add hashbase dat://0a9e202b8055721bd2bc93b3c9bbc03efdbda9cfee91f01a123fdeaadeba303e/

If you want to set multiple providers, just change the name when you invoke set-provider

For example:

# Configure external storage provider
dat-store set-provider example-store https://example.com/
dat-store login example-store yourusername
dat-store add example-store dat://0a9e202b8055721bd2bc93b3c9bbc03efdbda9cfee91f01a123fdeaadeba303e/
cupdike commented 5 years ago

I still see this problem:

$ dat-store set-provider mystore  http://myserver:3472

$ dat-store get-provider mystore
<USAGE>
Error: Provider URL not set for mystore
    at StoreClient.getProviderURL (/home/ubuntu/anaconda3/lib/node_modules/dat-store/client.js:101:21)
    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:52:5)
    at Function.Module.runMain (internal/modules/cjs/loader.js:880:11)
    at internal/main/run_main_module.js:21:11

$ cat ~/.config//dat-store-nodejs/config.json
{
    "providers": {
        "http://myserver:3472": "mystore"
    }
}
RangerMauve commented 5 years ago

Thank you for reporting this! Fixing it now. 💜

RangerMauve commented 5 years ago

Hey, I think this might be related to how yargs parses arguments.

I've switched the order of the arguments. Now you should be able to do something like this:

dat-store set-provider https://hashbase.io/ hashbase
dat-store login yourusername hashbase
dat-store add dat://0a9e202b8055721bd2bc93b3c9bbc03efdbda9cfee91f01a123fdeaadeba303e/ hashbase

This is out in version 3.0.0

cupdike commented 5 years ago

Thanks for the fast response! Unfortunately I'm seeing a different problem now: $ dat-store run-service TypeError: stat.isDirectory is not a function at stats.filter (/usr/local/lib/node_modules/dat-store/library.js:223:52) at Array.filter (<anonymous>) at Library.loadURLS (/usr/local/lib/node_modules/dat-store/library.js:223:30) $ dat-store --version 3.0.0 This is on my Mac (but it works on Ubuntu). Should I open up a separate issue?

RangerMauve commented 5 years ago

Oh shoot. That's because dat-store requires a newer version of node.js. It looks like it should be node 10.10.0 or higher.

I usually use the latest node 11. Node 12 doesn't work with Dat yet.

Sorry for the confusion! 😅 I'll add something to the README

cupdike commented 5 years ago

Yep, that fixed it... thanks again!

RangerMauve commented 5 years ago

Sweet! Do let me know if it works out for your use case. 😁