feat: add pqsql configs for open and idle connections (#1583)

When Postgres is used as the backing database for headscale,
it does not set a limit on maximum open and idle connections
which leads to hundreds of open connections to the Postgres
server.

This commit introduces the configuration variables to set those
values and also sets default while opening a new postgres connection.
This commit is contained in:
Pallab Pain 2024-02-09 22:04:28 +05:30 committed by GitHub
parent 91bb85e7d2
commit 9047c09871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 287 additions and 242 deletions

View file

@ -153,6 +153,9 @@ database:
# name: headscale
# user: foo
# pass: bar
# max_open_conns: 10
# max_idle_conns: 10
# conn_max_idle_time_secs: 3600
# # If other 'sslmode' is required instead of 'require(true)' and 'disabled(false)', set the 'sslmode' you need
# # in the 'db_ssl' field. Refers to https://www.postgresql.org/docs/current/libpq-ssl.html Table 34.1.