Documentation
¶
Overview ¶
Package httpsrv hosts the bot's HTTP listener: a read-only manifest viewer, a health endpoint, and (in follow-up commits) the slash-command handler plus signed approval URLs.
The package name avoids collision with the stdlib net/http import that callers also need.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignApprovalToken ¶
SignApprovalToken returns the HMAC-SHA256 token (URL-safe base64) that proves the holder is authorised to apply the named manifest. Exported so the bot can build approve URLs before sending them to chat.
Types ¶
type Options ¶
type Options struct {
SigningKey string
Connector cleanup.Connector
Audit *audit.Logger
BaseURL string
// Metrics, when non-nil, enables the /metrics endpoint and records
// approval-apply outcomes and latency. May be nil.
Metrics *metrics.Metrics
}
Options groups optional Server inputs that have grown beyond a sensible positional argument list. SigningKey and Connector are optional; supplying neither restricts the listener to the read-only endpoints (/health and /manifest/:id). Audit may be nil; the audit logger already treats a nil receiver as a no-op. BaseURL is the public URL the bot prints into chat replies (e.g. `https://natsie.example.com`); only used by the on-demand scan chat command.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an Echo instance with the bot-specific dependencies it needs (manifest store, signing key, NATS connector, audit log, logger).
func New ¶
New constructs the Server. Routes are registered immediately so callers can list them in startup logs. SigningKey gates the /slash and /approve endpoints; Connector additionally gates /approve (we don't expose the deletion path without a way to actually delete).
func (*Server) SignApproval ¶
SignApproval returns the HMAC-SHA256 token (base64url) that authorises the approval URL for the given manifest ID. Exported so the bot can build the link before sending it to chat.