MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetServerConfig

Method GetServerConfig

backend/store/server_config.go:14–26  ·  view source on GitHub ↗

GetServerConfig returns the global server configuration. Stored in the server_config table (single row, not workspace-scoped).

(ctx context.Context)

Source from the content-addressed store, hash-verified

12// GetServerConfig returns the global server configuration.
13// Stored in the server_config table (single row, not workspace-scoped).
14func (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.
29func (s *Store) GetAuthSecret(ctx context.Context) (string, error) {

Callers 1

GetAuthSecretMethod · 0.95

Calls 3

GetDBMethod · 0.95
ScanMethod · 0.80
UnmarshalMethod · 0.80

Tested by

no test coverage detected