| 18 | } |
| 19 | |
| 20 | func CurrentKVClient() (*Client, bool, error) { |
| 21 | client := Current() |
| 22 | if client == nil { |
| 23 | return nil, false, nil |
| 24 | } |
| 25 | if !client.Enabled() { |
| 26 | return nil, true, fmt.Errorf("home kv store unavailable: %w", ErrDisabled) |
| 27 | } |
| 28 | if !client.HeartbeatOK() { |
| 29 | return nil, true, fmt.Errorf("home kv store unavailable: %w", ErrNotConnected) |
| 30 | } |
| 31 | return client, true, nil |
| 32 | } |
| 33 | |
| 34 | func KVGetJSONRequired(ctx context.Context, key string, out any) (bool, bool, error) { |
| 35 | client, homeMode, errClient := CurrentKVClient() |