-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathapi_key.go
More file actions
40 lines (37 loc) · 1.2 KB
/
api_key.go
File metadata and controls
40 lines (37 loc) · 1.2 KB
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
32
33
34
35
36
37
38
39
40
package gemini
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://github.com/google-gemini/gemini-cli/blob/main/docs/cli/authentication.md"),
ManagementURL: sdk.URL("https://aistudio.google.com/app/apikey"),
Fields: []schema.CredentialField{
{
Name: fieldname.APIKey,
MarkdownDescription: "API Key used to authenticate to Google Gemini.",
Secret: true,
Composition: &schema.ValueComposition{
Length: 100,
Charset: schema.Charset{
Uppercase: true,
},
},
},
},
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
Importer: importer.TryAll(
importer.TryEnvVarPair(defaultEnvVarMapping),
),
}
}
var defaultEnvVarMapping = map[string]sdk.FieldName{
"GEMINI_API_KEY": fieldname.APIKey,
"GOOGLE_API_KEY": fieldname.APIKey,
}