Skip to content

Commit 5f2d998

Browse files
committed
change documentation for bootstrap Server|Client
* provide documentation for default and non-default invocation.
1 parent ba88c8c commit 5f2d998

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

Diff for: ca/bootstrap.go

+16-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,18 @@ func Bootstrap(token string) (*Client, error) {
3939
}
4040

4141
// 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.
4445
//
4546
// 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.
4754
// ctx, cancel := context.WithCancel(context.Background())
4855
// defer cancel()
4956
// srv, err := ca.BootstrapServer(ctx, token, &http.Server{
@@ -86,10 +93,14 @@ func BootstrapServer(ctx context.Context, token string, base *http.Server) (*htt
8693
// BootstrapClient is a helper function that using the given bootstrap token
8794
// return an http.Client configured with a Transport prepared to do TLS
8895
// 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.
9098
//
9199
// 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.
93104
// ctx, cancel := context.WithCancel(context.Background())
94105
// defer cancel()
95106
// client, err := ca.BootstrapClient(ctx, token)

0 commit comments

Comments
 (0)