[synchronizer] Run once before start listening for database udpate

At a time of restarting Kratos pod, we noticed to update the Kratos
config we need modify something in IdP UI to trigger the
synchronizer. Instead this change will run synchronizer initially so
it will update Kratos config with database IdP entries if any.
This commit is contained in:
Akshay Gaikwad
2022-05-03 12:50:32 +05:30
parent 31a89543b0
commit 6fda5831ee

View File

@@ -77,6 +77,14 @@ func main() {
sqldb := sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(dsn)))
db := bun.NewDB(sqldb, pgdialect.New())
// synchronize first
err := sync(ctx, db, outputPath)
if err != nil {
log.Errorf("sync failed: %s", err)
} else {
log.Info("Synchronized successfully")
}
ln := pgdriver.NewListener(db)
listen:
if err := ln.Listen(ctx, channel); err != nil {