feat: simplify SOP to immediate-effect configuration
This commit is contained in:
39
scripts/backfill-multitable/main.go
Normal file
39
scripts/backfill-multitable/main.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"git.iwork-ai.com/xdc/iqudo-top1/internal/config"
|
||||
"git.iwork-ai.com/xdc/iqudo-top1/internal/database"
|
||||
"git.iwork-ai.com/xdc/iqudo-top1/internal/logger"
|
||||
"git.iwork-ai.com/xdc/iqudo-top1/internal/multitable"
|
||||
)
|
||||
|
||||
func main() {
|
||||
configDir := flag.String("config-dir", "configs", "configuration directory")
|
||||
flag.Parse()
|
||||
cfg, err := config.Load(config.LoadOptions{ConfigDir: *configDir})
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "load configuration: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
log, err := logger.New(cfg.App.Env, cfg.App.Name)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "create logger: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer log.Sync()
|
||||
db, err := database.Open(cfg.Database, log)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "connect database: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
count, err := multitable.EnqueueBackfill(db)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "enqueue backfill: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("queued %d multitable projection events\n", count)
|
||||
}
|
||||
Reference in New Issue
Block a user