MCPcopy
hub / github.com/jackc/pgx / parseServiceSettings

Function parseServiceSettings

pgconn/config.go:754–771  ·  view source on GitHub ↗
(servicefilePath, serviceName string)

Source from the content-addressed store, hash-verified

752}
753
754func parseServiceSettings(servicefilePath, serviceName string) (map[string]string, error) {
755 servicefile, err := pgservicefile.ReadServicefile(servicefilePath)
756 if err != nil {
757 return nil, fmt.Errorf("failed to read service file: %v", servicefilePath)
758 }
759
760 service, err := servicefile.GetService(serviceName)
761 if err != nil {
762 return nil, fmt.Errorf("unable to find service: %v", serviceName)
763 }
764
765 settings := make(map[string]string, len(service.Settings))
766 for k, v := range service.Settings {
767 settings[canonicalConnStringKey(k)] = v
768 }
769
770 return settings, nil
771}
772
773// configTLS uses libpq's TLS parameters to construct []*tls.Config. It is
774// necessary to allow returning multiple TLS configs as sslmode "allow" and

Callers 1

ParseConfigWithOptionsFunction · 0.85

Calls 1

canonicalConnStringKeyFunction · 0.85

Tested by

no test coverage detected