summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2025-02-01 12:36:05 -0500
committerRobby Zambito <contact@robbyzambito.me>2025-02-09 16:21:36 -0500
commit7101dd003be4b85ac57b387998d22cc6eaf4aa51 (patch)
treebd579bce3255f875516f77bac9dd8ae2fe5162df
parentcb61f0817fa4206ad4482b7337e618f80776cc27 (diff)
Add support for inbox prefix
-rw-r--r--main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.go b/main.go
index 8005aab..d0479e6 100644
--- a/main.go
+++ b/main.go
@@ -24,6 +24,7 @@ func printHelp() {
fmt.Println(" NATS_NKEY - NATS NKEY for authentication (optional)")
fmt.Println(" NATS_NKEY_SEED - NATS NKEY seed for authentication (optional)")
fmt.Println(" NATS_CREDS_FILE - Path to NATS credentials file (optional)")
+ fmt.Println(" NATS_INBOX_PREFIX - Subject prefix for NATS messages (default: _INBOX)")
fmt.Println(" HTTP_PORT - HTTP port to listen on (default: 8080)")
}
@@ -46,6 +47,7 @@ func main() {
natsNkey := os.Getenv("NATS_NKEY")
natsNkeySeed := os.Getenv("NATS_NKEY_SEED")
natsCredsFile := os.Getenv("NATS_CREDS_FILE")
+ natsInboxPrefix := os.Getenv("NATS_INBOX_PREFIX")
// Read HTTP port from environment variables
httpPort := os.Getenv("HTTP_PORT")
@@ -66,6 +68,10 @@ func main() {
opts = append(opts, nats.UserCredentials(natsCredsFile))
}
+ if natsInboxPrefix != "" {
+ opts = append(opts, nats.CustomInboxPrefix(natsInboxPrefix))
+ }
+
nc, err := nats.Connect(natsURL, opts...)
if err != nil {
log.Fatal("Error connecting to NATS:", err)