-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathservice_token.go
More file actions
42 lines (39 loc) · 1.28 KB
/
service_token.go
File metadata and controls
42 lines (39 loc) · 1.28 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
41
42
package doppler
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 ServiceToken() schema.CredentialType {
return schema.CredentialType{
Name: credname.PersonalAccessToken,
DocsURL: sdk.URL("https://docs.doppler.com/docs/cli"),
ManagementURL: sdk.URL("https://dashboard.doppler.com/workplace/<workplace-id>/tokens/personal"),
Fields: []schema.CredentialField{
{
Name: fieldname.Token,
MarkdownDescription: "Personal Token used to authenticate to Doppler.",
Secret: true,
Composition: &schema.ValueComposition{
Prefix: "dp.pt.",
Charset: schema.Charset{
Uppercase: true,
Lowercase: true,
Digits: true,
},
},
},
},
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
Importer: importer.TryAll(
importer.TryEnvVarPair(defaultEnvVarMapping),
importer.TryAllEnvVars(fieldname.Token, "DOPPLER_TOKEN"),
),
}
}
var defaultEnvVarMapping = map[string]sdk.FieldName{
"DOPPLER_TOKEN": fieldname.Token,
}