Skip to content

Commit

Permalink
docs: document env vars in readme (#131)
Browse files Browse the repository at this point in the history
- explain `W3_PRINCIPAL`, `W3_STORE_NAME`, `W3UP_SERVICE_URL` and
`W3UP_SERVICE_DID`
- remove beta warning. we prod now.

License: MIT

---------

Signed-off-by: Oli Evans <[email protected]>
  • Loading branch information
olizilla authored Nov 16, 2023
1 parent b551a59 commit ca21f67
Showing 1 changed file with 39 additions and 11 deletions.
50 changes: 39 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<h1 align="center">⁂<br/>web3.storage</h1>
<h3 align="center">💾 w3 command line interface.</h3>
<p align="center">
<a href="https://github.com/web3-storage/w3cli/actions/workflows/test.yml"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/web3-storage/w3cli/test.yml?branch=main&style=for-the-badge" /></a>
<a href="https://discord.com/channels/806902334369824788/864892166470893588"><img src="https://img.shields.io/badge/chat-discord?style=for-the-badge&logo=discord&label=discord&logoColor=ffffff&color=7389D8" /></a>
<a href="https://github.com/web3-storage/w3cli/blob/main/LICENSE.md"><img alt="License: Apache-2.0 OR MIT" src="https://img.shields.io/badge/LICENSE-Apache--2.0%20OR%20MIT-yellow?style=for-the-badge" /></a>
</p>
# `w3cli`

💾 the `w3` command line interface.

## Getting started

Install the CLI from npm (**`w3up-client` requires Node 18 or higher**):
Install the CLI from npm (**requires Node 18 or higher**):

```console
npm install -g @web3-storage/w3cli
Expand All @@ -29,7 +25,6 @@ w3 space register # defaults to registering you with web3.storage

If you'd like to learn more about what is going on under the hood with w3up and its use of Spaces, [UCANs](https://ucan.xyz/), and more, check out the `w3up-client` README [here](https://github.com/web3-storage/w3up/tree/main/packages/w3up-client#usage).

> By registering your w3up beta Space with [web3.storage](http://web3.storage/), you agree to the w3up beta [Terms of Service](https://console.web3.storage/terms). Until the beta period is over and this migration occurs, uploads to w3up will not appear in your web3.storage account (and vice versa), even if you register with the same email.

Upload a file or directory:

Expand Down Expand Up @@ -238,8 +233,41 @@ Remove an upload from the current space's upload list. Does not remove CAR from

## Environment Variables

By default, `w3` will use the w3up service at https://up.web3.storage. If you would like
to use a different w3up-compatible service, you can use the `W3UP_SERVICE_DID` and `W3UP_SERVICE_URL` environment variables to set the service DID and URL endpoint.
### `W3_PRINCIPAL`

Set the key `w3` should use to sign ucan invocations. By default `w3` will generate a new Ed25519 key on first run and store it. Set it along with a custom `W3_STORE_NAME` to manage multiple custom keys and profiles. Trying to use an existing store with different keys will fail.

You can generate Ed25519 keys with [`ucan-key`](https://github.com/olizilla/ucan-key) e.g. `npx ucan-key ed`

**Usage**
```bash
W3_PRINCIPAL=$(npx ucan-key ed --json | jq -r .key) W3_STORE_NAME="other" w3 whoami
did:key:z6Mkf7bvSNgoXk67Ubhie8QMurN9E4yaCCGBzXow78zxnmuB
```

Default _unset_, a random Ed25519 key is generated.

### `W3_STORE_NAME`

Allows you to use `w3` with different profiles. You could use it to log in with different emails and keep the delegations separate.

`w3` stores state to disk using the [`conf`](https://github.com/sindresorhus/conf) module. `W3_STORE_NAME` sets the conf [`configName`](https://github.com/sindresorhus/conf#configname) option.

Default `w3cli`

### `W3UP_SERVICE_URL`

`w3` will use the w3up service at https://up.web3.storage. If you would like
to use a different w3up-compatible service, set `W3UP_SERVICE_DID` and `W3UP_SERVICE_URL` environment variables to set the service DID and URL endpoint.

Default `https://up.web3.storage`

### `W3UP_SERVICE_DID`

`w3` will use the w3up `did:web:web3.storage` as the service did. If you would like
to use a different w3up-compatible service, set `W3UP_SERVICE_DID` and `W3UP_SERVICE_URL` environment variables to set the service DID and URL endpoint.

Default `did:web:web3.storage`

## FAQ

Expand Down

0 comments on commit ca21f67

Please sign in to comment.