forked from sandstorm/caddy-nats-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.go
31 lines (25 loc) · 1.14 KB
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package caddy_nats_bridge
import (
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
"github.com/sandstorm/caddy-nats-bridge/body_jetstream"
"github.com/sandstorm/caddy-nats-bridge/logoutput"
"github.com/sandstorm/caddy-nats-bridge/natsbridge"
"github.com/sandstorm/caddy-nats-bridge/publish"
"github.com/sandstorm/caddy-nats-bridge/request"
"github.com/sandstorm/caddy-nats-bridge/subscribe"
)
func init() {
caddy.RegisterModule(natsbridge.NatsBridgeApp{})
httpcaddyfile.RegisterGlobalOption("nats", natsbridge.ParseGobalNatsOption)
caddy.RegisterModule(subscribe.Subscribe{})
caddy.RegisterModule(publish.Publish{})
httpcaddyfile.RegisterHandlerDirective("nats_publish", publish.ParsePublishHandler)
caddy.RegisterModule(request.Request{})
httpcaddyfile.RegisterHandlerDirective("nats_request", request.ParseRequestHandler)
// store request body to Jetstream
caddy.RegisterModule(body_jetstream.StoreBodyToJetStream{})
httpcaddyfile.RegisterHandlerDirective("store_body_to_jetstream", body_jetstream.ParseStoreBodyToJetstream)
// logging output to NATS
caddy.RegisterModule(logoutput.LogOutput{})
}