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

Function parseEnvSettings

pgconn/config.go:579–617  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

577}
578
579func parseEnvSettings() map[string]string {
580 settings := make(map[string]string)
581
582 nameMap := map[string]string{
583 "PGHOST": "host",
584 "PGPORT": "port",
585 "PGDATABASE": "database",
586 "PGUSER": "user",
587 "PGPASSWORD": "password",
588 "PGPASSFILE": "passfile",
589 "PGAPPNAME": "application_name",
590 "PGCONNECT_TIMEOUT": "connect_timeout",
591 "PGSSLMODE": "sslmode",
592 "PGSSLKEY": "sslkey",
593 "PGSSLCERT": "sslcert",
594 "PGSSLSNI": "sslsni",
595 "PGSSLROOTCERT": "sslrootcert",
596 "PGSSLPASSWORD": "sslpassword",
597 "PGSSLNEGOTIATION": "sslnegotiation",
598 "PGTARGETSESSIONATTRS": "target_session_attrs",
599 "PGSERVICE": "service",
600 "PGSERVICEFILE": "servicefile",
601 "PGTZ": "timezone",
602 "PGOPTIONS": "options",
603 "PGMINPROTOCOLVERSION": "min_protocol_version",
604 "PGMAXPROTOCOLVERSION": "max_protocol_version",
605 "PGCHANNELBINDING": "channel_binding",
606 "PGREQUIREAUTH": "require_auth",
607 }
608
609 for envname, realname := range nameMap {
610 value := os.Getenv(envname)
611 if value != "" {
612 settings[realname] = value
613 }
614 }
615
616 return settings
617}
618
619func parseURLSettings(connString string) (map[string]string, error) {
620 settings := make(map[string]string)

Callers 1

ParseConfigWithOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected