Skip to content

Commit

Permalink
clarify flag usage + check fireblocks flags all set
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim committed Mar 15, 2024
1 parent 58440c0 commit a74b05d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 5 additions & 5 deletions flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,29 @@ var (
}
EcdsaPrivateKeyFlag = cli.StringFlag{
Name: "ecdsa-private-key",
Usage: "Ethereum ecdsa private key",
Usage: "Ethereum ecdsa private key. If not set, Fireblocks credentials must be set.",
EnvVar: envVarPrefix + "ECDSA_PRIVATE_KEY",
}
// Fireblocks flags
FireblocksAPIKeyFlag = cli.StringFlag{
Name: "fireblocks-api-key",
Usage: "Fireblocks API Key",
Usage: "Fireblocks API Key. Ignored if ecdsa-private-key is set.",
EnvVar: envVarPrefix + "FIREBLOCKS_API_KEY",
}
FireblocksAPISecretFlag = cli.StringFlag{
Name: "fireblocks-api-secret",
Usage: "Fireblocks API Secret",
Usage: "Fireblocks API Secret. Ignored if ecdsa-private-key is set.",
EnvVar: envVarPrefix + "FIREBLOCKS_API_SECRET",
}
FireblocksBaseURLFlag = cli.StringFlag{
Name: "fireblocks-api-url",
Usage: "Fireblocks API URL",
Usage: "Fireblocks API URL. Ignored if ecdsa-private-key is set.",
EnvVar: envVarPrefix + "FIREBLOCKS_API_URL",
Value: "https://api.fireblocks.io",
}
FireblocksVaultAccountNameFlag = cli.StringFlag{
Name: "fireblocks-vault-account-name",
Usage: "Fireblocks Vault Account Name",
Usage: "Fireblocks Vault Account Name. Ignored if ecdsa-private-key is set.",
EnvVar: envVarPrefix + "FIREBLOCKS_VAULT_ACCOUNT_NAME",
}
)
Expand Down
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ func avsSyncMain(cliCtx *cli.Context) error {
fbSecret := cliCtx.String(FireblocksAPISecretFlag.Name)
fbBaseURL := cliCtx.String(FireblocksBaseURLFlag.Name)
fbVaultAccountName := cliCtx.String(FireblocksVaultAccountNameFlag.Name)
if fbAPIKey == "" {
return errors.New("Fireblocks API key is not set")
}
if fbSecret == "" {
return errors.New("Fireblocks API secret is not set")
}
if fbBaseURL == "" {
return errors.New("Fireblocks base URL is not set")
}
if fbVaultAccountName == "" {
return errors.New("Fireblocks vault account name is not set")
}

fireblocksClient, err := fireblocks.NewClient(
fbAPIKey,
Expand Down

0 comments on commit a74b05d

Please sign in to comment.