MQ, KV and MQ allocator

This commit is contained in:
2024-10-24 23:46:09 +08:00
parent aa67bd0b8f
commit 23d14e4e46
11 changed files with 578 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import (
"git.solsynth.dev/hypernet/nexus/pkg/internal/directory"
"git.solsynth.dev/hypernet/nexus/pkg/internal/http"
"git.solsynth.dev/hypernet/nexus/pkg/internal/kv"
"git.solsynth.dev/hypernet/nexus/pkg/internal/mq"
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
"github.com/fatih/color"
"os"
@@ -58,6 +59,14 @@ func main() {
log.Info().Msg("Connected to kv (etcd)!")
}
// Connect to message queue (nats)
log.Info().Msg("Connecting to MQ (nats)...")
if err := mq.ConnectNats(viper.GetString("mq.addr")); err != nil {
log.Error().Err(err).Msg("An error occurred when connecting to MQ (nats). MQ related feature will be disabled.")
} else {
log.Info().Msg("Connected to MQ (nats)!")
}
// Connect to database
log.Info().Msg("Connecting to database...")
if db, err := database.Connect(viper.GetString("database.dsn")); err != nil {