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
12
app.go
12
app.go
|
@ -129,13 +129,19 @@ 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 dbname=%s user=%s sslmode=disable",
|
||||
cfg.DBhost,
|
||||
cfg.DBport,
|
||||
cfg.DBname,
|
||||
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:
|
||||
dbString = cfg.DBpath
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue