Skip to content

Commit 91fd225

Browse files
committed
docs: add authentication section to readme.
Document the new and existing authentication methods.
1 parent 5196849 commit 91fd225

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,44 @@ func main() {
5757
fmt.Printf("%+v\n", resp)
5858
}
5959
```
60+
61+
### Authentication
62+
63+
The client supports several authentication methods.
64+
65+
1. Explicit configuration: Set `Host` and `Token` in the `Config`:
66+
67+
```go
68+
cfg := oxide.Config{
69+
Host: "https://api.oxide.computer",
70+
Token: "oxide-abc123",
71+
}
72+
```
73+
74+
1. Environment variables: Set `OXIDE_HOST` and `OXIDE_TOKEN`:
75+
76+
```bash
77+
export OXIDE_HOST="https://api.oxide.computer"
78+
export OXIDE_TOKEN="oxide-abc123"
79+
```
80+
81+
1. Oxide profile: Use a profile from the Oxide config file:
82+
- Set `Profile` in the `Config`:
83+
```go
84+
cfg := oxide.Config{
85+
Profile: "my-profile",
86+
}
87+
```
88+
- Or set the `OXIDE_PROFILE` environment variable:
89+
```bash
90+
export OXIDE_PROFILE="my-profile"
91+
```
92+
93+
1. Default profile: Use the default profile from the Oxide config file:
94+
```go
95+
cfg := oxide.Config{
96+
UseDefaultProfile: true,
97+
}
98+
```
99+
100+
When using profiles, the client reads from the Oxide CLI configuration files located at `$HOME/.config/oxide/credentials.toml` (or a custom directory via `Config.ConfigDir`).

0 commit comments

Comments
 (0)