caddytls: Debug log on implicit tailscale error (#5041)

This commit is contained in:
Matthew Holt 2022-09-16 09:42:05 -06:00
parent b6cec37893
commit 258071d857
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5

View File

@ -66,7 +66,9 @@ func (ts Tailscale) canHazCertificate(ctx context.Context, hello *tls.ClientHell
status, err := tscert.GetStatus(ctx) status, err := tscert.GetStatus(ctx)
if err != nil { if err != nil {
if ts.Optional { if ts.Optional {
return false, nil // ignore error if we don't expect/require it to work anyway // ignore error if we don't expect/require it to work anyway, but log it for debugging
ts.logger.Debug("error getting tailscale status", zap.Error(err), zap.String("server_name", hello.ServerName))
return false, nil
} }
return false, err return false, err
} }
@ -81,7 +83,6 @@ func (ts Tailscale) canHazCertificate(ctx context.Context, hello *tls.ClientHell
// UnmarshalCaddyfile deserializes Caddyfile tokens into ts. // UnmarshalCaddyfile deserializes Caddyfile tokens into ts.
// //
// ... tailscale // ... tailscale
//
func (Tailscale) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { func (Tailscale) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
for d.Next() { for d.Next() {
if d.NextArg() { if d.NextArg() {
@ -179,7 +180,6 @@ func (hcg HTTPCertGetter) GetCertificate(ctx context.Context, hello *tls.ClientH
// UnmarshalCaddyfile deserializes Caddyfile tokens into ts. // UnmarshalCaddyfile deserializes Caddyfile tokens into ts.
// //
// ... http <url> // ... http <url>
//
func (hcg *HTTPCertGetter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { func (hcg *HTTPCertGetter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
for d.Next() { for d.Next() {
if !d.NextArg() { if !d.NextArg() {