CreateIdentRules will create the content of pg_ident.conf file given the rules set by the cluster spec
(ident []string, username string)
| 639 | // CreateIdentRules will create the content of pg_ident.conf file given |
| 640 | // the rules set by the cluster spec |
| 641 | func 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 |
| 660 | type PgConfiguration struct { |
no test coverage detected