mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-02 03:33:05 +00:00
Add ability to connect to PostgreSQL via unix socket
This commit is contained in:
parent
09cd7ba304
commit
ec5acf7be2
3 changed files with 13 additions and 3 deletions
|
@ -5,6 +5,7 @@
|
||||||
- Updated dependencies (including the library that lacked armhf support) [#722](https://github.com/juanfont/headscale/pull/722)
|
- Updated dependencies (including the library that lacked armhf support) [#722](https://github.com/juanfont/headscale/pull/722)
|
||||||
- Fix missing group expansion in function `excludeCorretlyTaggedNodes` [#563](https://github.com/juanfont/headscale/issues/563)
|
- Fix missing group expansion in function `excludeCorretlyTaggedNodes` [#563](https://github.com/juanfont/headscale/issues/563)
|
||||||
- Improve registration protocol implementation and switch to NodeKey as main identifier [#725](https://github.com/juanfont/headscale/pull/725)
|
- Improve registration protocol implementation and switch to NodeKey as main identifier [#725](https://github.com/juanfont/headscale/pull/725)
|
||||||
|
- Add ability to connect to PostgreSQL via unix socket [#734](https://github.com/juanfont/headscale/pull/734)
|
||||||
|
|
||||||
## 0.16.0 (2022-07-25)
|
## 0.16.0 (2022-07-25)
|
||||||
|
|
||||||
|
|
12
app.go
12
app.go
|
@ -129,13 +129,19 @@ func NewHeadscale(cfg *Config) (*Headscale, error) {
|
||||||
switch cfg.DBtype {
|
switch cfg.DBtype {
|
||||||
case Postgres:
|
case Postgres:
|
||||||
dbString = fmt.Sprintf(
|
dbString = fmt.Sprintf(
|
||||||
"host=%s port=%d dbname=%s user=%s password=%s sslmode=disable",
|
"host=%s dbname=%s user=%s sslmode=disable",
|
||||||
cfg.DBhost,
|
cfg.DBhost,
|
||||||
cfg.DBport,
|
|
||||||
cfg.DBname,
|
cfg.DBname,
|
||||||
cfg.DBuser,
|
cfg.DBuser,
|
||||||
cfg.DBpass,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if cfg.DBport != 0 {
|
||||||
|
dbString += fmt.Sprintf(" port=%d", cfg.DBport)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg.DBpass != "" {
|
||||||
|
dbString += fmt.Sprintf(" password=%s", cfg.DBpass)
|
||||||
|
}
|
||||||
case Sqlite:
|
case Sqlite:
|
||||||
dbString = cfg.DBpath
|
dbString = cfg.DBpath
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -116,6 +116,9 @@ db_path: /var/lib/headscale/db.sqlite
|
||||||
# # Postgres config
|
# # Postgres config
|
||||||
# db_type: postgres
|
# db_type: postgres
|
||||||
# db_host: localhost
|
# db_host: localhost
|
||||||
|
|
||||||
|
# This should be set when using a TCP connection, set it to '0' or keep it unset if
|
||||||
|
# connecting through a unix socket.
|
||||||
# db_port: 5432
|
# db_port: 5432
|
||||||
# db_name: headscale
|
# db_name: headscale
|
||||||
# db_user: foo
|
# db_user: foo
|
||||||
|
|
Loading…
Reference in a new issue