// Package automc wires automc-specific extensions onto upstream mc-router. // // All behavior is opt-in via env vars; when AUTOMC_DSN is unset, Wire is a no-op // and the binary behaves exactly like upstream itzg/mc-router. package automc import ( "context" "os" "github.com/sirupsen/logrus" ) func Wire(ctx context.Context) error { dsn := os.Getenv("AUTOMC_DSN") if dsn == "" { return nil } waker := newWakerConfig(os.Getenv("AUTOMC_WAKER_URL"), os.Getenv("AUTOMC_WAKER_TOKEN")) s := newSyncer(dsn, waker) go s.run(ctx) logrus.Info("automc: pg route sync started") // Operator UI on a separate port — upstream's API_BINDING stays // JSON-only and untouched. Enable by setting AUTOMC_UI_BINDING (e.g. // ":8082"); leave unset to skip and behave exactly like upstream. if uiBinding := os.Getenv("AUTOMC_UI_BINDING"); uiBinding != "" { bus := NewLogBus(500) logrus.AddHook(&logrusBusHook{bus: bus}) startUI(ctx, uiBinding, bus) } return nil }