MCPcopy
hub / github.com/dgraph-io/dgraph / SlashTLSConfig

Function SlashTLSConfig

x/tls_helper.go:152–163  ·  view source on GitHub ↗

SlashTLSConfig returns the TLS config appropriate for SlashGraphQL This assumes that endpoint is not empty, and in the format "domain.grpc.cloud.dg.io:443"

(endpoint string)

Source from the content-addressed store, hash-verified

150// SlashTLSConfig returns the TLS config appropriate for SlashGraphQL
151// This assumes that endpoint is not empty, and in the format "domain.grpc.cloud.dg.io:443"
152func SlashTLSConfig(endpoint string) (*tls.Config, error) {
153 pool, err := generateCertPool("", true)
154 if err != nil {
155 return nil, err
156 }
157 hostWithoutPort := strings.Split(endpoint, ":")[0]
158 return &tls.Config{
159 RootCAs: pool,
160 ServerName: hostWithoutPort,
161 MinVersion: tls.VersionTLS12,
162 }, nil
163}
164
165// LoadClientTLSConfig loads the TLS config into the client with the given parameters.
166func LoadClientTLSConfig(v *viper.Viper) (*tls.Config, error) {

Callers 1

LoadClientTLSConfigFunction · 0.85

Calls 1

generateCertPoolFunction · 0.70

Tested by

no test coverage detected