@@ -39,11 +39,18 @@ func Bootstrap(token string) (*Client, error) {
39
39
}
40
40
41
41
// BootstrapServer is a helper function that returns an http.Server configured
42
- // with the given address and handler, and prepared to use TLS connections. The
43
- // certificate will automatically rotate if necessary.
42
+ // with the given address and handler, and prepared to use TLS connections.
43
+ // By default the server will kick off a routine that will renew the
44
+ // certificate after 2/3rd of the certificate's lifetime has expired.
44
45
//
45
46
// Usage:
46
- // // make sure to cancel the rotation goroutine
47
+ // // Default example with certificate rotation.
48
+ // srv, err := ca.BootstrapServer(context.Background(), token, &http.Server{
49
+ // Addr: ":443",
50
+ // Handler: handler,
51
+ // })
52
+ //
53
+ // // Example canceling automatic certificate rotation.
47
54
// ctx, cancel := context.WithCancel(context.Background())
48
55
// defer cancel()
49
56
// srv, err := ca.BootstrapServer(ctx, token, &http.Server{
@@ -86,10 +93,14 @@ func BootstrapServer(ctx context.Context, token string, base *http.Server) (*htt
86
93
// BootstrapClient is a helper function that using the given bootstrap token
87
94
// return an http.Client configured with a Transport prepared to do TLS
88
95
// connections using the client certificate returned by the certificate
89
- // authority. The certificate will automatically rotate if necessary.
96
+ // authority. By default the server will kick off a routine that will renew the
97
+ // certificate after 2/3rd of the certificate's lifetime has expired.
90
98
//
91
99
// Usage:
92
- // // make sure to cancel the rotation goroutine
100
+ // // Default example with certificate rotation.
101
+ // client, err := ca.BootstrapClient(ctx.Background(), token)
102
+ //
103
+ // // Example canceling automatic certificate rotation.
93
104
// ctx, cancel := context.WithCancel(context.Background())
94
105
// defer cancel()
95
106
// client, err := ca.BootstrapClient(ctx, token)
0 commit comments