cloud/https: factor out Cloud Storage autocert cache

Move the Cloud Storage autocert cache to package cloud/autocert.
This package will be moved to the repository, but
we first commit it here so that we can keep everything running
until we remove all GCP-related stuff in one fell swoop.

This change adds a CloudAutocert method to the cloud/https.Options type
which sets up the Cloud Storage autocert cache. This is just a
convenience, and it will also be removed when we remove the rest of the
GCP stuff.

To make this all work, and to take advantage of the churn to do some
tidying, we also add Addr and AutocertCache fields to the Options
struct, remove the addr and serverName arguments from ListenAndServe,
and add the OptionsFromFlags function (which will be used by the gcp
server implementations).

Change-Id: I801967186b246b5f7b1ce1c23b41a2f9a9d91583
Reviewed-by: Rob Pike <>
diff --git a/cmd/demoserver/main.go b/cmd/demoserver/main.go
index 58f8197..4e9565b 100644
--- a/cmd/demoserver/main.go
+++ b/cmd/demoserver/main.go
@@ -62,7 +62,7 @@
 	http.Handle("/api/Store/", storeserver.New(cfg, s.StoreServer(), addr))
 	http.Handle("/api/Dir/", dirserver.New(cfg, s.DirServer(), addr))
-	https.ListenAndServeFromFlags(nil, "demoserver")
+	https.ListenAndServeFromFlags(nil)
 // box represents an opened box.