-
Notifications
You must be signed in to change notification settings - Fork 191
/
kms_wallet_config.go
42 lines (38 loc) · 1.07 KB
/
kms_wallet_config.go
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 common
import (
"github.com/urfave/cli"
)
type KMSKeyConfig struct {
KeyID string
Region string
Disable bool
}
func KMSWalletCLIFlags(envPrefix string, flagPrefix string) []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: PrefixFlag(flagPrefix, "kms-key-id"),
Usage: "KMS key ID that stores the private key",
Required: false,
EnvVar: PrefixEnvVar(envPrefix, "KMS_KEY_ID"),
},
cli.StringFlag{
Name: PrefixFlag(flagPrefix, "kms-key-region"),
Usage: "KMS key region",
Required: false,
EnvVar: PrefixEnvVar(envPrefix, "KMS_KEY_REGION"),
},
cli.BoolFlag{
Name: PrefixFlag(flagPrefix, "kms-key-disable"),
Usage: "Disable KMS wallet",
Required: false,
EnvVar: PrefixEnvVar(envPrefix, "KMS_KEY_DISABLE"),
},
}
}
func ReadKMSKeyConfig(ctx *cli.Context, flagPrefix string) KMSKeyConfig {
return KMSKeyConfig{
KeyID: ctx.String(PrefixFlag(flagPrefix, "kms-key-id")),
Region: ctx.String(PrefixFlag(flagPrefix, "kms-key-region")),
Disable: ctx.Bool(PrefixFlag(flagPrefix, "kms-key-disable")),
}
}