Skip to content

Commit

Permalink
remove 0 value constraint from backup-file-count
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeenkaur committed Nov 24, 2023
1 parent 90d1dc7 commit 73574b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/config/yaml_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func IsValidLogRotateConfig(config LogRotateConfig) error {
if config.MaxFileSizeMB <= 0 {
return fmt.Errorf("max-file-size-mb should be atleast 1")
}
if config.BackupFileCount <= 0 {
return fmt.Errorf("backup-file-count should be atleast 1")
if config.BackupFileCount < 0 {
return fmt.Errorf("backup-file-count should be 0 (to retain all backup files) or a positive value")
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/config/yaml_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@ func (t *YamlParserTest) TestReadConfigFile_InvalidLogRotateConfig2() {

AssertNe(nil, err)
AssertTrue(strings.Contains(err.Error(),
fmt.Sprintf(parseConfigFileErrMsgFormat, "backup-file-count should be atleast 1")))
fmt.Sprintf(parseConfigFileErrMsgFormat, "backup-file-count should be 0 (to retain all backup files) or a positive value")))
}

0 comments on commit 73574b3

Please sign in to comment.