-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.go
27 lines (24 loc) · 1.1 KB
/
configuration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package ipso
// Configuration to control the registry.
type Configuration struct {
InitOnNew bool // indicates whether registry should be initialized from API on creation
SkipInitErrors bool // indicates whether to ignore particular resource or object initialization errors
Sanitize bool // whether objects and Resources description should be cleaned up on registry init
Sanitizer []string // strings that should be removed from resource and object description
// TODO add `Throttle` field to decrease load on OMAs API
}
// DefaultConfiguration creates a Configuration with the default settings.
func DefaultConfiguration() Configuration {
return Configuration{
InitOnNew: true,
SkipInitErrors: true, // true by default, because OMA API returns some objects without ObjectLink filled in,
// which makes it impossible to initialize objects and resources with strict validation
Sanitize: true,
}
}
// DefaultSanitizer returns an array with default sanitizer strings.
func DefaultSanitizer() []string {
return []string{
"\n", "\\\n", "\t", "\\t", "\\", "•", " ",
}
}