Add context to bootstrap methods.

This commit is contained in:
Mariano Cano 2018-11-06 17:16:33 -08:00
parent 299eea233b
commit ba88c8c5cb
5 changed files with 99 additions and 41 deletions

View file

@ -1,6 +1,7 @@
package main
import (
"context"
"fmt"
"io/ioutil"
"os"
@ -17,7 +18,11 @@ func main() {
token := os.Args[1]
client, err := ca.BootstrapClient(token)
// make sure to cancel the renew goroutine
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
client, err := ca.BootstrapClient(ctx, token)
if err != nil {
panic(err)
}