diff options
| author | Chia <Chia@93.nz> | 2026-08-04 19:58:52 +1200 |
|---|---|---|
| committer | Chia <Chia@93.nz> | 2026-08-04 20:43:23 +1200 |
| commit | 5b651488b081b65fda8a323f228e139adb79a35d (patch) | |
| tree | 08baf40efb8fe103b32721cd991ff712323e3173 /cmd/migrate | |
Build AI gateway control plane and admin UI
Diffstat (limited to '')
| -rw-r--r-- | cmd/migrate/main.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go new file mode 100644 index 0000000..20452f9 --- /dev/null +++ b/cmd/migrate/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "context" + "flag" + "fmt" + "os" + "time" + + "aigw/internal/controlplane" +) + +func main() { + environment := flag.String("database-url-env", "AIGW_DATABASE_URL", "environment variable containing the PostgreSQL URL") + flag.Parse() + databaseURL := os.Getenv(*environment) + if databaseURL == "" { + fmt.Fprintf(os.Stderr, "%s is empty\n", *environment) + os.Exit(1) + } + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + if err := controlplane.MigrateDatabase(ctx, databaseURL); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + fmt.Println("control-plane schema is up to date") +} |
