1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-09-06 17:54:31 +02:00

fix: Missing config type deserialization

This commit is contained in:
1fexd 2025-07-19 21:29:30 +02:00
parent 018fdd7a2b
commit 16a76c9b96
No known key found for this signature in database
GPG Key ID: B459DD424E49FAAD

View File

@ -113,7 +113,7 @@ type DNSConfig struct {
type TlsCertConfig struct { type TlsCertConfig struct {
// Type sets the tls cert type, one of "hetzner", ... // Type sets the tls cert type, one of "hetzner", ...
Type string Type string `mapstructure:"type"`
Hetzner HetznerTlsCertConfig `mapstructure:"hetzner"` Hetzner HetznerTlsCertConfig `mapstructure:"hetzner"`
} }
@ -654,18 +654,22 @@ func dns() (DNSConfig, error) {
dns.ExtraRecordsPath = viper.GetString("dns.extra_records_path") dns.ExtraRecordsPath = viper.GetString("dns.extra_records_path")
if viper.IsSet("dns.tls_cert") { if viper.IsSet("dns.tls_cert") {
zoneName := dns.BaseDomain certType := viper.GetString("dns.tls_cert.type")
if viper.IsSet("dns.tls_cert.hetzner.zone_name") { if certType == TlsCertHetzner {
zoneName = viper.GetString("dns.tls_cert.hetzner.zone_name") zoneName := dns.BaseDomain
} if viper.IsSet("dns.tls_cert.hetzner.zone_name") {
zoneName = viper.GetString("dns.tls_cert.hetzner.zone_name")
}
dns.TlsCert = TlsCertConfig{ dns.TlsCert = TlsCertConfig{
Hetzner: HetznerTlsCertConfig{ Type: certType,
ApiToken: viper.GetString("dns.tls_cert.hetzner.api_token"), Hetzner: HetznerTlsCertConfig{
ZoneId: viper.GetString("dns.tls_cert.hetzner.zone_id"), ApiToken: viper.GetString("dns.tls_cert.hetzner.api_token"),
ZoneName: zoneName, ZoneId: viper.GetString("dns.tls_cert.hetzner.zone_id"),
Ttl: viper.GetInt("dns.tls_cert.hetzner.ttl"), ZoneName: zoneName,
}, Ttl: viper.GetInt("dns.tls_cert.hetzner.ttl"),
},
}
} }
} }