This repository was archived by the owner on Jul 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,12 @@ func readConfiguration(configFile *string, reader fs.FileReader) Configuration {
62
62
}
63
63
64
64
func validateConfiguration (reader fs.FileReader , configFile * string ) {
65
+ schema := loadSchema ()
66
+ if schema == nil {
67
+ return
68
+ }
65
69
jsonSchemaValidator := JsonSchemaValidator {
66
- Schema : loadSchema () ,
70
+ Schema : schema ,
67
71
FileReader : reader ,
68
72
}
69
73
validationError := jsonSchemaValidator .Validate ("file://" + * configFile )
@@ -73,9 +77,10 @@ func validateConfiguration(reader fs.FileReader, configFile *string) {
73
77
}
74
78
75
79
func loadSchema () * jsonsch.Schema {
76
- schema , err := jsonsch .NewSchema (jsonsch .NewReferenceLoader ("file ://docs /schema.json" ))
80
+ schema , err := jsonsch .NewSchema (jsonsch .NewReferenceLoader ("https ://fbiville.github.io/headache/v1.0.0-M01 /schema.json" ))
77
81
if err != nil {
78
- log .Fatalf ("headache configuration error, cannot load JSON schema\n \t %v\n " , err )
82
+ log .Printf ("headache configuration warning: cannot load schema, skipping configuration validation. See reason below:\n \t %v\n " , err )
83
+ return nil
79
84
}
80
85
return schema
81
86
}
You can’t perform that action at this time.
0 commit comments