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,12 +654,15 @@ 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") {
certType := viper.GetString("dns.tls_cert.type")
if certType == TlsCertHetzner {
zoneName := dns.BaseDomain zoneName := dns.BaseDomain
if viper.IsSet("dns.tls_cert.hetzner.zone_name") { if viper.IsSet("dns.tls_cert.hetzner.zone_name") {
zoneName = viper.GetString("dns.tls_cert.hetzner.zone_name") zoneName = viper.GetString("dns.tls_cert.hetzner.zone_name")
} }
dns.TlsCert = TlsCertConfig{ dns.TlsCert = TlsCertConfig{
Type: certType,
Hetzner: HetznerTlsCertConfig{ Hetzner: HetznerTlsCertConfig{
ApiToken: viper.GetString("dns.tls_cert.hetzner.api_token"), ApiToken: viper.GetString("dns.tls_cert.hetzner.api_token"),
ZoneId: viper.GetString("dns.tls_cert.hetzner.zone_id"), ZoneId: viper.GetString("dns.tls_cert.hetzner.zone_id"),
@ -668,6 +671,7 @@ func dns() (DNSConfig, error) {
}, },
} }
} }
}
if viper.IsSet("dns.extra_records") { if viper.IsSet("dns.extra_records") {
var extraRecords []tailcfg.DNSRecord var extraRecords []tailcfg.DNSRecord