Skip to content

Commit

Permalink
Merge pull request #423 from authzed/tstirrat15-patch-1
Browse files Browse the repository at this point in the history
Add some documentation about overriding context
  • Loading branch information
tstirrat15 authored Sep 20, 2024
2 parents 46db2fe + 871e420 commit 3837e8f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,27 @@ sudo dnf install -y zed

Contexts store connection credentials for accessing SpiceDB clusters securely in the OS keychain.
Before performing most commands, a context must be set.
Alternatively, you can provide context values via environment variables which will override the existing context for that execution.

The `zed context` subcommand has operations for setting the current, creating, listing, deleting contexts:

```sh
zed context set prod grpc.authzed.com:443 tc_zed_my_laptop_deadbeefdeadbeefdeadbeefdeadbeef
zed context set dev localhost:80 testpresharedkey
zed context set dev localhost:80 testpresharedkey --insecure
zed context list
```

### Overriding Context

You can also provide context values via environment variables or CLI flags. If values are provided this way, they override
the context values in a piecemeal fashion:

```sh
zed context set prod grpc.authzed.com:443 tc_zed_my_laptop_deadbeefdeadbeefdeadbeefdeadbeef

# This will use the token and TLS values set above, but swap out the endpoint for the one provided.
zed permission check --endpoint my.authzed.domain:443 document:firstdoc writer user:emilia
```

### Headless usage

If you provide all context values (e.g. `ZED_ENDPOINT`, `ZED_TOKEN`) as environment variables or flags (e.g. `--endpoint`, `--token`), you do not need to set a context.
Expand Down

0 comments on commit 3837e8f

Please sign in to comment.