GetServerPort gets the port where the postmaster will be listening using the environment variable or, when empty, the default one
()
| 496 | // GetServerPort gets the port where the postmaster will be listening |
| 497 | // using the environment variable or, when empty, the default one |
| 498 | func 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 |
no test coverage detected