feat(emqx): PG-auth in EMQX v0.2.4 + EnsureBridgeDevice v0.1.2 (tail 3)
This commit is contained in:
@@ -58,6 +58,16 @@ func main() {
|
||||
defer devices.Close()
|
||||
log.Info("devices store ready")
|
||||
|
||||
// Служебная строка бриджа в iot_devices — для PG-auth EMQX (хвост 3).
|
||||
ensureCtx, ensureCancel := context.WithTimeout(ctx, 10*time.Second)
|
||||
err = devices.EnsureBridgeDevice(ensureCtx, cfg.MQTTUsername, cfg.MQTTPassword)
|
||||
ensureCancel()
|
||||
if err != nil {
|
||||
log.Error("ensure bridge device", "err", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
log.Info("bridge device ensured", "username", cfg.MQTTUsername)
|
||||
|
||||
iotStore, err := iotpg.New(cfg.IOTPGDSN, log)
|
||||
if err != nil {
|
||||
log.Error("iotpg store", "err", err)
|
||||
|
||||
Reference in New Issue
Block a user