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

Function GetServerPort

pkg/management/postgres/instance.go:498–512  ·  view source on GitHub ↗

GetServerPort gets the port where the postmaster will be listening using the environment variable or, when empty, the default one

()

Source from the content-addressed store, hash-verified

496// GetServerPort gets the port where the postmaster will be listening
497// using the environment variable or, when empty, the default one
498func GetServerPort() int {
499 pgPort := os.Getenv("PGPORT")
500 if pgPort == "" {
501 return postgres.ServerPort
502 }
503
504 result, err := strconv.Atoi(pgPort)
505 if err != nil {
506 log.Info("Wrong port number inside the process environment variables",
507 "PGPORT", pgPort)
508 return postgres.ServerPort
509 }
510
511 return result
512}
513
514// Startup starts up a PostgreSQL instance and wait for the instance to be
515// started

Callers 6

instance_test.goFile · 0.85
buildPrimaryConnInfoFunction · 0.85
StartupMethod · 0.85
ConnectionPoolMethod · 0.85
metricsConnectionPoolMethod · 0.85

Calls 1

InfoMethod · 0.80

Tested by

no test coverage detected