1
0
Fork 0

Add support for "exit on failure"

master
Philip O'Toole 1 year ago
parent 63ace34a95
commit ae9bc98741

@ -76,10 +76,11 @@ func (s *StorageType) UnmarshalJSON(b []byte) error {
// Config is the config file format for the upload service
type Config struct {
Version int `json:"version"`
Type StorageType `json:"type"`
Timeout Duration `json:"timeout,omitempty"`
Sub json.RawMessage `json:"sub"`
Version int `json:"version"`
Type StorageType `json:"type"`
Timeout Duration `json:"timeout,omitempty"`
ExitOnFailure bool `json:"exit_on_failure,omitempty"`
Sub json.RawMessage `json:"sub"`
}
// Unmarshal unmarshals the config file and returns the config and subconfig

@ -133,9 +133,10 @@ func TestUnmarshal(t *testing.T) {
}
`),
expectedCfg: &Config{
Version: 1,
Type: "s3",
Timeout: 30 * Duration(time.Second),
Version: 1,
Type: "s3",
Timeout: 30 * Duration(time.Second),
ExitOnFailure: false,
},
expectedS3: &aws.S3Config{
AccessKeyID: "test_id",
@ -152,6 +153,7 @@ func TestUnmarshal(t *testing.T) {
{
"version": 1,
"type": "s3",
"exit_on_failure": true,
"sub": {
"access_key_id": "test_id",
"secret_access_key": "test_secret",
@ -162,9 +164,10 @@ func TestUnmarshal(t *testing.T) {
}
`),
expectedCfg: &Config{
Version: 1,
Type: "s3",
Timeout: Duration(30 * time.Second),
Version: 1,
Type: "s3",
Timeout: Duration(30 * time.Second),
ExitOnFailure: true,
},
expectedS3: &aws.S3Config{
AccessKeyID: "test_id",

Loading…
Cancel
Save