Config retrieves the configuration from Redis.
()
| 28 | |
| 29 | // Config retrieves the configuration from Redis. |
| 30 | func (s *ConfigStorage) Config() (*config.Config, error) { |
| 31 | data, err := s.client.Get(ctx, withNamespace(s.namespacePrefix, configPrefix, "")).Bytes() |
| 32 | if err != nil { |
| 33 | // If the key does not exist, return a new configuration. |
| 34 | if err == redis.Nil { |
| 35 | return config.NewConfig(), nil |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | var cfg config.Config |
| 40 | if err := json.Unmarshal(data, &cfg); err != nil { |
| 41 | return nil, err |
| 42 | } |
| 43 | |
| 44 | return &cfg, nil |
| 45 | } |
nothing calls this directly
no test coverage detected