Skip to content

Commit b4c772a

Browse files
authored
fix: sheriff.toml config should be optional (#37)
1 parent e4f5a65 commit b4c772a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

internal/config/patrol.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ func GetPatrolConfiguration(cliOpts PatrolCLIOpts) (config PatrolConfig, err err
6666
if cliOpts.Config != "" {
6767
found, err := getTOMLFile(cliOpts.Config, &tomlOpts)
6868
if !found {
69-
return config, fmt.Errorf("failed to find configuration file %v", cliOpts.Config)
70-
} else if err != nil {
69+
zerolog.Info().Msg("No configuration file found, running with CLI options only")
70+
}
71+
if err != nil {
7172
return config, errors.Join(errors.New("failed to parse patrol configuration file"), err)
7273
}
7374

internal/config/patrol_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ func TestGetPatrolConfigurationInexistentFile(t *testing.T) {
7373
Verbose: true,
7474
})
7575

76-
assert.NotNil(t, err)
76+
// It is allowed to run sheriff without a configuration file
77+
assert.Nil(t, err)
7778
}
7879

7980
func TestParseUrls(t *testing.T) {

0 commit comments

Comments
 (0)