44 "errors"
55 "fmt"
66 "net/url"
7- "sheriff/internal/toml"
87
98 zerolog "github.com/rs/zerolog/log"
109)
@@ -49,14 +48,14 @@ type PatrolCommonOpts struct {
4948 Report PatrolReportOpts `toml:"report"`
5049}
5150
52- // Options only available from CLI configuration
51+ // PatrolCLIOpts are the options only available from CLI configuration
5352type PatrolCLIOpts struct {
5453 Config string
5554 Verbose bool
5655 PatrolCommonOpts
5756}
5857
59- // Options only available from File configuration
58+ // PatrolFileOpts are the options only available from File configuration
6059type PatrolFileOpts struct {
6160 PatrolCommonOpts
6261}
@@ -65,7 +64,7 @@ func GetPatrolConfiguration(cliOpts PatrolCLIOpts) (config PatrolConfig, err err
6564 zerolog .Debug ().Interface ("cli options" , cliOpts ).Msg ("Running with cli options" )
6665 var tomlOpts PatrolFileOpts
6766 if cliOpts .Config != "" {
68- found , err := toml . GetFile (cliOpts .Config , & tomlOpts )
67+ found , err := getTOMLFile (cliOpts .Config , & tomlOpts )
6968 if ! found {
7069 return config , fmt .Errorf ("failed to find configuration file %v" , cliOpts .Config )
7170 } else if err != nil {
@@ -105,7 +104,7 @@ func mergeConfigs(cliOpts PatrolCLIOpts, fileOpts PatrolFileOpts) (config Patrol
105104 return
106105}
107106
108- // Returns valueA if != nil, otherwise valueB if != nil, otherwise the provided default value
107+ // getCliOrFileOption returns valueA if != nil, otherwise valueB if != nil, otherwise the provided default value
109108func getCliOrFileOption [T interface {}](valueA * T , valueB * T , def T ) (r T ) {
110109 if valueA != nil {
111110 return * valueA
0 commit comments