GetServerConfig returns the global server configuration. Stored in the server_config table (single row, not workspace-scoped).
(ctx context.Context)
| 12 | // GetServerConfig returns the global server configuration. |
| 13 | // Stored in the server_config table (single row, not workspace-scoped). |
| 14 | func (s *Store) GetServerConfig(ctx context.Context) (*storepb.ServerConfigPayload, error) { |
| 15 | var payloadBytes []byte |
| 16 | if err := s.GetDB().QueryRowContext(ctx, |
| 17 | `SELECT payload FROM server_config LIMIT 1`, |
| 18 | ).Scan(&payloadBytes); err != nil { |
| 19 | return nil, errors.Wrap(err, "failed to get server config") |
| 20 | } |
| 21 | config := &storepb.ServerConfigPayload{} |
| 22 | if err := common.ProtojsonUnmarshaler.Unmarshal(payloadBytes, config); err != nil { |
| 23 | return nil, errors.Wrap(err, "failed to unmarshal server config") |
| 24 | } |
| 25 | return config, nil |
| 26 | } |
| 27 | |
| 28 | // GetAuthSecret returns the global auth secret used for JWT signing. |
| 29 | func (s *Store) GetAuthSecret(ctx context.Context) (string, error) { |
no test coverage detected