feat: add support for TLS with Postgres

This commit is contained in:
azz 2022-08-16 08:50:30 +01:00
parent 193b4213b3
commit 4c7f54020b
No known key found for this signature in database
GPG key ID: FA4B7CA14E83F106
2 changed files with 6 additions and 1 deletions

5
app.go
View file

@ -129,13 +129,16 @@ func NewHeadscale(cfg *Config) (*Headscale, error) {
switch cfg.DBtype {
case Postgres:
dbString = fmt.Sprintf(
"host=%s port=%d dbname=%s user=%s password=%s sslmode=disable",
"host=%s port=%d dbname=%s user=%s password=%s",
cfg.DBhost,
cfg.DBport,
cfg.DBname,
cfg.DBuser,
cfg.DBpass,
)
if !cfg.DBssl {
dbString = dbString + " sslmode=disable"
}
case Sqlite:
dbString = cfg.DBpath
default: