| index 6c572811a..ea2994893 100644 |
| --- a/internal/registry/registry.go |
| +++ b/internal/registry/registry.go |
| @@ -49,6 +49,7 @@ type Route struct { |
| Canary bool |
| Replication string // "" | "stream" | "batched" | "daily" |
| NextDue int64 |
| + StatusNamed bool // publish this route's app by name on the status page — the app's own opt-in |
| |
| // Backing is who owns the instance's process: "" = an exec child of the |
| // agent (the activator spawns live/<host> itself — the Eleven shape), or |
| @@ -123,6 +124,7 @@ CREATE TABLE IF NOT EXISTS routes ( |
| `ALTER TABLE routes ADD COLUMN replication TEXT NOT NULL DEFAULT ''`, |
| `ALTER TABLE routes ADD COLUMN next_due INTEGER NOT NULL DEFAULT 0`, |
| `ALTER TABLE routes ADD COLUMN backing TEXT NOT NULL DEFAULT ''`, |
| + `ALTER TABLE routes ADD COLUMN status_named INTEGER NOT NULL DEFAULT 0`, |
| } { |
| if _, err := r.sql.Exec(stmt); err != nil && !strings.Contains(err.Error(), "duplicate column") { |
| return err |
| @@ -133,17 +135,18 @@ CREATE TABLE IF NOT EXISTS routes ( |
| |
| const routeCols = `host, slug, kind, socket, addr, status, last_error, db_path, |
| version, prev_version, app, pool, region, channel, hibernate, canary, |
| -replication, next_due, backing, created_at` |
| +replication, next_due, backing, status_named, created_at` |
| |
| func scanRoute(scan func(...any) error) (Route, error) { |
| var t Route |
| - var hib, can int |
| + var hib, can, sn int |
| err := scan(&t.Host, &t.Slug, &t.Kind, &t.Socket, &t.Addr, &t.Status, |
| &t.LastError, &t.DBPath, &t.Version, &t.PrevVersion, &t.App, &t.Pool, |
| &t.Region, &t.Channel, &hib, &can, &t.Replication, &t.NextDue, &t.Backing, |
| - &t.CreatedAt) |
| + &sn, &t.CreatedAt) |
| t.Hibernate = hib != 0 |
| t.Canary = can != 0 |
| + t.StatusNamed = sn != 0 |
| return t, err |
| } |
| |
| @@ -218,7 +221,7 @@ func (r *Registry) Upsert(t Route) error { |
| } |
| _, err := r.sql.Exec(` |
| INSERT INTO routes (`+routeCols+`) |
| -VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
| +VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
| ON CONFLICT(host) DO UPDATE SET |
| slug=excluded.slug, kind=excluded.kind, socket=excluded.socket, |
| addr=excluded.addr, status=excluded.status, last_error=excluded.last_error, |
| @@ -227,11 +230,11 @@ ON CONFLICT(host) DO UPDATE SET |
| region=excluded.region, channel=excluded.channel, |
| hibernate=excluded.hibernate, canary=excluded.canary, |
| replication=excluded.replication, next_due=excluded.next_due, |
| - backing=excluded.backing`, |
| + backing=excluded.backing, status_named=excluded.status_named`, |
| t.Host, t.Slug, t.Kind, t.Socket, t.Addr, t.Status, t.LastError, |
| t.DBPath, t.Version, t.PrevVersion, t.App, t.Pool, t.Region, t.Channel, |
| b2i(t.Hibernate), b2i(t.Canary), t.Replication, t.NextDue, t.Backing, |
| - t.CreatedAt) |
| + b2i(t.StatusNamed), t.CreatedAt) |
| return err |
| } |
| |