MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / AppendUnstructured

Method AppendUnstructured

internal/postgres/hba.go:226–238  ·  view source on GitHub ↗

AppendUnstructured trims and adds unvalidated pg_hba.conf lines to o. Empty lines and lines that are entirely control characters are omitted.

(hbas ...string)

Source from the content-addressed store, hash-verified

224// AppendUnstructured trims and adds unvalidated pg_hba.conf lines to o.
225// Empty lines and lines that are entirely control characters are omitted.
226func (o *OrderedHBAs) AppendUnstructured(hbas ...string) {
227 for _, hba := range hbas {
228 hba = strings.TrimFunc(hba, func(r rune) bool {
229 // control characters, space, and backslash
230 return r > '~' || r < '!' || r == '\\'
231 })
232
233 // NOTE: Skipping "include" directives here is a security measure.
234 if len(hba) > 0 && !strings.HasPrefix(hba, "include") {
235 o.records = append(o.records, hba)
236 }
237 }
238}
239
240// AsStrings returns a copy of o as a slice.
241func (o *OrderedHBAs) AsStrings() []string {

Callers 3

generatePostgresHBAsMethod · 0.80
TestOrderedHBAsFunction · 0.80
TestDynamicConfigurationFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestOrderedHBAsFunction · 0.64
TestDynamicConfigurationFunction · 0.64