Files
go-caatsm/cmd/main/main.go
T
windyboy 24c9beeb13 refactor: Update NATS subscription logic and configuration
The code changes in `main.go` update the NATS subscription logic and configuration. The `Subscribe` function now uses the `NatsHandler` struct to handle the subscription. The `NewNatsHandler` function is added to create a new instance of the `NatsHandler` with the provided configuration. The configuration values are passed to the `NatsSubscriber` constructor to set up the NATS subscription. This refactor improves the modularity and readability of the NATS subscription code.
2024-07-21 23:09:29 +08:00

24 lines
464 B
Go

package main
import (
"caatsm/internal/config"
"caatsm/internal/nats"
"caatsm/pkg/utils"
)
func main() {
cfg, err := config.LoadConfig()
if err != nil {
utils.Logger.WithError(err).Fatal("Error loading config")
}
if err := config.ValidateConfig(cfg); err != nil {
utils.Logger.WithError(err).Fatal("Config validation error")
}
utils.Logger.Info("Loaded configuration successfully")
subscribe := nats.NewNatsHandler(cfg)
subscribe.Subscribe()
}