forked from 1Password/shell-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_key.go
More file actions
31 lines (28 loc) · 980 Bytes
/
Copy pathapi_key.go
File metadata and controls
31 lines (28 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package opencode
import (
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/importer"
"github.com/1Password/shell-plugins/sdk/provision"
"github.com/1Password/shell-plugins/sdk/schema"
"github.com/1Password/shell-plugins/sdk/schema/credname"
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
)
func APIKey() schema.CredentialType {
return schema.CredentialType{
Name: credname.APIKey,
DocsURL: sdk.URL("https://opencode.ai/docs/"),
ManagementURL: sdk.URL("https://opencode.ai/auth"),
Fields: []schema.CredentialField{
{
Name: fieldname.APIKey,
MarkdownDescription: "API Key used to authenticate to OpenCode.",
Secret: true,
},
},
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
Importer: importer.TryEnvVarPair(defaultEnvVarMapping),
}
}
var defaultEnvVarMapping = map[string]sdk.FieldName{
"OPENCODE_API_KEY": fieldname.APIKey,
}