如何修复 headscale 启动错误 failed to configure TLS (sslmode is invalid)

问题:

启动 headscale 0.17.0 或更新版本时,你看到重复的错误消息如

headscale-error.txt
headscale_1  | 2022-11-26T20:03:39Z FTL go/src/headscale/cmd/headscale/cli/server.go:21 > Error initializing error="cannot parse `host=postgres dbname=headscale user=headscale sslmode= port=5432 password=xxxxx`: failed to configure TLS (sslmode is invalid)"

解决方案

此错误由于从 headscale 0.17.0 开始的更改而发生。在你的 config.yaml 中,添加

db_ssl: false

config.yaml
db_ssl: false

db_type: ... 之后

完整数据库部分配置示例:

config.yaml
# # Postgres 配置
db_type: postgres
db_host: postgres
db_port: 5432
db_name: headscale
db_user: headscale
db_pass: Paep6AhJiZeedie5fiefieV0quohro

db_ssl: false

之后,重启 headscale,错误消息应该消失。


Check out similar posts by category: Headscale