docs(smtp): fix fictional launcher.Register/health.Register in doc examples #2

Merged
Rene Nochebuena merged 1 commits from fix/wiring-docs into main 2026-08-07 22:19:52 -06:00
2 changed files with 9 additions and 4 deletions
Showing only changes of commit b7da0e37ed - Show all commits
+3 -2
View File
@@ -19,8 +19,9 @@
import "code.nochebuena.dev/einherjar/smtp" import "code.nochebuena.dev/einherjar/smtp"
mailer := smtp.New(logger, smtp.DefaultConfig()) mailer := smtp.New(logger, smtp.DefaultConfig())
launcher.Append(mailer) // OnInit verifies credentials; OnStop is a no-op lc.Append(mailer) // OnInit verifies credentials; OnStop is a no-op
health.Register(mailer) // dial check; LevelDegraded // mailer is observability.Checkable (dial check, LevelDegraded):
srv.Get("/health", health.NewHandler(logger, mailer).ServeHTTP)
``` ```
When `cfg.Host` is empty, `New` returns a no-op that logs every `Send` call at debug level and always returns nil. No code changes are needed between environments. When `cfg.Host` is empty, `New` returns a no-op that logs every `Send` call at debug level and always returns nil. No code changes are needed between environments.
+6 -2
View File
@@ -12,8 +12,12 @@
// # Lifecycle Registration // # Lifecycle Registration
// //
// client := smtp.New(logger, cfg) // client := smtp.New(logger, cfg)
// launcher.Register(client) // lc.Append(client) // lifecycle: OnInit → OnStop
// health.Register(client) //
// client satisfies [observability.Checkable], so it can back a health endpoint via
// web/health.NewHandler:
//
// srv.Get("/health", health.NewHandler(logger, client).ServeHTTP)
// //
// # Sending // # Sending
// //