-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor signer to it's own config (#151)
* refactor signer to it's own config * replace in create * fix unmarshall * remove print * chainid to int64
- Loading branch information
1 parent
3fc61e6
commit c6c9887
Showing
8 changed files
with
188 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package types | ||
|
||
type FireblocksConfig struct { | ||
APIKey string `yaml:"api_key"` | ||
SecretKey string `yaml:"secret_key"` | ||
BaseUrl string `yaml:"base_url"` | ||
VaultAccountName string `yaml:"vault_account_name"` | ||
|
||
SecretStorageType SecretStorageType `yaml:"secret_storage_type"` | ||
|
||
// AWSRegion is the region where the secret is stored in AWS Secret Manager | ||
AWSRegion string `yaml:"aws_region"` | ||
|
||
// Timeout for API in seconds | ||
Timeout int64 `yaml:"timeout"` | ||
} | ||
|
||
func (f *FireblocksConfig) MarshalYAML() (interface{}, error) { | ||
return struct { | ||
APIKey string `yaml:"api_key"` | ||
SecretKey string `yaml:"secret_key"` | ||
BaseUrl string `yaml:"base_url"` | ||
VaultAccountName string `yaml:"vault_account_name"` | ||
SecretStorageType SecretStorageType `yaml:"secret_storage_type"` | ||
AWSRegion string `yaml:"aws_region"` | ||
Timeout int64 `yaml:"timeout"` | ||
}{ | ||
APIKey: f.APIKey, | ||
SecretKey: f.SecretKey, | ||
BaseUrl: f.BaseUrl, | ||
VaultAccountName: f.VaultAccountName, | ||
SecretStorageType: f.SecretStorageType, | ||
AWSRegion: f.AWSRegion, | ||
Timeout: f.Timeout, | ||
}, nil | ||
} | ||
|
||
func (f *FireblocksConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { | ||
var aux struct { | ||
APIKey string `yaml:"api_key"` | ||
SecretKey string `yaml:"secret_key"` | ||
BaseUrl string `yaml:"base_url"` | ||
VaultAccountName string `yaml:"vault_account_name"` | ||
SecretStorageType SecretStorageType `yaml:"secret_storage_type"` | ||
AWSRegion string `yaml:"aws_region"` | ||
Timeout int64 `yaml:"timeout"` | ||
} | ||
if err := unmarshal(&aux); err != nil { | ||
return err | ||
} | ||
f.APIKey = aux.APIKey | ||
f.SecretKey = aux.SecretKey | ||
f.BaseUrl = aux.BaseUrl | ||
f.VaultAccountName = aux.VaultAccountName | ||
f.SecretStorageType = aux.SecretStorageType | ||
f.AWSRegion = aux.AWSRegion | ||
f.Timeout = aux.Timeout | ||
return nil | ||
} |
Oops, something went wrong.