Merge pull request #472 from adamantike/misc/add-support-for-yml-config-files

This commit is contained in:
Jason Kulatunga
2023-04-06 17:46:03 -07:00
committed by GitHub
2 changed files with 14 additions and 2 deletions
@@ -30,8 +30,14 @@ func main() {
os.Exit(1) os.Exit(1)
} }
configFilePath := "/opt/scrutiny/config/collector.yaml"
configFilePathAlternative := "/opt/scrutiny/config/collector.yml"
if !utils.FileExists(configFilePath) && utils.FileExists(configFilePathAlternative) {
configFilePath = configFilePathAlternative
}
//we're going to load the config file manually, since we need to validate it. //we're going to load the config file manually, since we need to validate it.
err = config.ReadConfig("/opt/scrutiny/config/collector.yaml") // Find and read the config file err = config.ReadConfig(configFilePath) // Find and read the config file
if _, ok := err.(errors.ConfigFileMissingError); ok { // Handle errors reading the config file if _, ok := err.(errors.ConfigFileMissingError); ok { // Handle errors reading the config file
//ignore "could not find config file" //ignore "could not find config file"
} else if err != nil { } else if err != nil {
+7 -1
View File
@@ -29,8 +29,14 @@ func main() {
os.Exit(1) os.Exit(1)
} }
configFilePath := "/opt/scrutiny/config/scrutiny.yaml"
configFilePathAlternative := "/opt/scrutiny/config/scrutiny.yml"
if !utils.FileExists(configFilePath) && utils.FileExists(configFilePathAlternative) {
configFilePath = configFilePathAlternative
}
//we're going to load the config file manually, since we need to validate it. //we're going to load the config file manually, since we need to validate it.
err = config.ReadConfig("/opt/scrutiny/config/scrutiny.yaml") // Find and read the config file err = config.ReadConfig(configFilePath) // Find and read the config file
if _, ok := err.(errors.ConfigFileMissingError); ok { // Handle errors reading the config file if _, ok := err.(errors.ConfigFileMissingError); ok { // Handle errors reading the config file
//ignore "could not find config file" //ignore "could not find config file"
} else if err != nil { } else if err != nil {