MCPcopy Create free account
hub / github.com/diillson/chatcli / hubEnabledSource

Function hubEnabledSource

cli/hub_local.go:78–88  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
78func 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.
91func resolveHubPrincipal(ctx context.Context, store hub.Store) string {

Callers 3

RunGatewayForegroundMethod · 0.85
TestHubEnabledSourceFunction · 0.85
maybeEnableLocalHubMethod · 0.85

Calls 1

GetSettingMethod · 0.65

Tested by 1

TestHubEnabledSourceFunction · 0.68