Skip to content

Commit 734edd3

Browse files
committed
Document example usage for config#TLS
1 parent cb10768 commit 734edd3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

config/tls.go

+19
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ import (
1111
// It provides options to enable TLS, specify certificate and key files,
1212
// CA certificate, and whether to skip verification of the server's certificate chain and host name.
1313
// Use the [TLS.MakeConfig] method to assemble a [*tls.Config] from the TLS struct.
14+
//
15+
// Example usage:
16+
//
17+
// func main() {
18+
// tlsConfig := &config.TLS{
19+
// Enable: true,
20+
// Cert: "path/to/cert.pem",
21+
// Key: "path/to/key.pem",
22+
// Ca: "path/to/ca.pem",
23+
// Insecure: false,
24+
// }
25+
//
26+
// cfg, err := tlsConfig.MakeConfig("example.com")
27+
// if err != nil {
28+
// log.Fatalf("error creating TLS config: %v", err)
29+
// }
30+
//
31+
// // ...
32+
// }
1433
type TLS struct {
1534
// Enable indicates whether TLS is enabled.
1635
Enable bool `yaml:"tls"`

0 commit comments

Comments
 (0)