Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document env vars in readme #131

Merged
merged 3 commits into from
Nov 16, 2023
Merged
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
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