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

Function GetPGSSLMode

backend/plugin/db/util/ssl.go:223–234  ·  view source on GitHub ↗

GetPGSSLMode is used only when SSL is enabled. We should consider allowing user to override this default in the future even if SSL is enabled.

(ds *storepb.DataSource)

Source from the content-addressed store, hash-verified

221// GetPGSSLMode is used only when SSL is enabled.
222// We should consider allowing user to override this default in the future even if SSL is enabled.
223func GetPGSSLMode(ds *storepb.DataSource) SSLMode {
224 if !ds.GetVerifyTlsCertificate() {
225 return sslModeRequire
226 }
227 sslMode := sslModeVerifyFull
228 if ds.GetSslCa() != "" {
229 if ds.GetSshHost() != "" {
230 sslMode = sslModeVerifyCA
231 }
232 }
233 return sslMode
234}
235
236// ApplyPGTLSConfig applies Bytebase TLS settings to pgx primary and fallback TLS configs.
237func ApplyPGTLSConfig(tlscfg *tls.Config, host string, fallbacks []*pgconn.FallbackConfig) {

Callers 2

getPGConnectionConfigFunction · 0.92

Calls 3

GetSslCaMethod · 0.45
GetSshHostMethod · 0.45

Tested by

no test coverage detected