hubEnabledSource reports WHERE the hub enabled/disabled decision came from — "db setting", "env CHATCLI_HUB_ENABLED" or "default". Continuity silently dying because a forgotten exported variable disabled the hub is exactly the kind of failure that must name its source in the log.
(ctx context.Context, store hub.Store)
| 76 | // dying because a forgotten exported variable disabled the hub is exactly the |
| 77 | // kind of failure that must name its source in the log. |
| 78 | func hubEnabledSource(ctx context.Context, store hub.Store) string { |
| 79 | if store != nil { |
| 80 | if v, ok, err := store.GetSetting(ctx, hubKeyEnabled); err == nil && ok && v != "" { |
| 81 | return "db setting enabled=" + v |
| 82 | } |
| 83 | } |
| 84 | if v := strings.TrimSpace(os.Getenv(envHubEnabled)); v != "" { |
| 85 | return "env " + envHubEnabled + "=" + v |
| 86 | } |
| 87 | return "default" |
| 88 | } |
| 89 | |
| 90 | // resolveHubPrincipal returns the shared single-user principal. |
| 91 | func resolveHubPrincipal(ctx context.Context, store hub.Store) string { |