Commit adeefc6b75
Verified · cmc
internal/push/apns.go +10 −1
| @@ -7,6 +7,7 @@ import ( | ||
| 7 | 7 | "encoding/json" |
| 8 | 8 | "fmt" |
| 9 | 9 | "io" |
| 10 | "log/slog" | |
| 10 | 11 | "net/http" |
| 11 | 12 | "os" |
| 12 | 13 | "strconv" |
| @@ -65,8 +66,16 @@ func NewClient(cfg config.Push) (*Client, error) { | ||
| 65 | 66 | // speaks plain HTTP/1.1 rather than negotiating TLS, so the same override |
| 66 | 67 | // has to drop the scheme too, or every request fails with "server gave |
| 67 | 68 | // HTTP response to HTTPS client" instead of reaching the fake at all. |
| 69 | // | |
| 70 | // The drop is logged rather than silent. config.Push's own doc comment | |
| 71 | // promises a misconfigured [push] fails loudly at startup rather than | |
| 72 | // filling a queue nobody is watching; a stray GITBAY_APNS_HOST on a real | |
| 73 | // instance would otherwise send the provider JWT over cleartext with no | |
| 74 | // sign anything had changed, where the pre-override behaviour at least | |
| 75 | // failed loudly by attempting TLS against a host that cannot answer it. | |
| 68 | 76 | func apnsScheme() string { |
| 69 | if os.Getenv("GITBAY_APNS_HOST") != "" { | |
| 77 | if h := os.Getenv("GITBAY_APNS_HOST"); h != "" { | |
| 78 | slog.Warn("push: GITBAY_APNS_HOST is set, sending to it over plain HTTP instead of APNs", "host", h) | |
| 70 | 79 | return "http" |
| 71 | 80 | } |
| 72 | 81 | return "https" |