MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / CreateIdentRules

Function CreateIdentRules

pkg/postgres/configuration.go:641–657  ·  view source on GitHub ↗

CreateIdentRules will create the content of pg_ident.conf file given the rules set by the cluster spec

(ident []string, username string)

Source from the content-addressed store, hash-verified

639// CreateIdentRules will create the content of pg_ident.conf file given
640// the rules set by the cluster spec
641func CreateIdentRules(ident []string, username string) (string, error) {
642 var identContent bytes.Buffer
643
644 templateData := struct {
645 Mappings []string
646 Username string
647 }{
648 Mappings: ident,
649 Username: username,
650 }
651
652 if err := identTemplate.Execute(&identContent, templateData); err != nil {
653 return "", err
654 }
655
656 return identContent.String(), nil
657}
658
659// PgConfiguration wraps configuration parameters with some checks
660type PgConfiguration struct {

Callers 2

Calls 2

ExecuteMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected