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

Function LoadServerTLSConfig

x/tls_helper.go:133–148  ·  view source on GitHub ↗

LoadServerTLSConfig loads the TLS config into the server with the given parameters.

(v *viper.Viper)

Source from the content-addressed store, hash-verified

131
132// LoadServerTLSConfig loads the TLS config into the server with the given parameters.
133func LoadServerTLSConfig(v *viper.Viper) (*tls.Config, error) {
134 tlsFlag := z.NewSuperFlag(v.GetString("tls")).MergeAndCheckDefault(TLSDefaults)
135
136 if tlsFlag.GetPath("server-cert") == "" && tlsFlag.GetPath("server-key") == "" {
137 return nil, nil
138 }
139
140 conf := TLSHelperConfig{}
141 conf.RootCACert = tlsFlag.GetPath("ca-cert")
142 conf.CertRequired = true
143 conf.Cert = tlsFlag.GetPath("server-cert")
144 conf.Key = tlsFlag.GetPath("server-key")
145 conf.ClientAuth = tlsFlag.GetString("client-auth-type")
146 conf.UseSystemCACerts = tlsFlag.GetBool("use-system-ca")
147 return GenerateServerTLSConfig(&conf)
148}
149
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"

Callers 2

runFunction · 0.92
setupServerFunction · 0.92

Calls 1

GenerateServerTLSConfigFunction · 0.85

Tested by

no test coverage detected