website: flag doc cleanup, and log before listening

This commit is contained in:
Brad Fitzpatrick 2015-12-24 14:51:15 -08:00
parent 622a88da15
commit 1ef5252da3
2 changed files with 13 additions and 11 deletions

View File

@ -51,7 +51,7 @@ import (
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/compute/v1"
compute "google.golang.org/api/compute/v1"
storageapi "google.golang.org/api/storage/v1"
"google.golang.org/cloud"
"google.golang.org/cloud/compute/metadata"
@ -64,21 +64,21 @@ const defaultAddr = ":31798" // default webserver address
var h1TitlePattern = regexp.MustCompile(`<h1>([^<]+)</h1>`)
var (
httpAddr = flag.String("http", defaultAddr, "HTTP service address (e.g., '"+defaultAddr+"')")
httpsAddr = flag.String("https", "", "HTTPS service address")
httpAddr = flag.String("http", defaultAddr, "HTTP address")
httpsAddr = flag.String("https", "", "HTTPS address")
root = flag.String("root", "", "Website root (parent of 'static', 'content', and 'tmpl")
logDir = flag.String("logdir", "", "Directory to write log files to (one per hour), or empty to not log.")
logStdout = flag.Bool("logstdout", true, "Write to stdout?")
logStdout = flag.Bool("logstdout", true, "Whether to log to stdout")
tlsCertFile = flag.String("tlscert", "", "TLS cert file")
tlsKeyFile = flag.String("tlskey", "", "TLS private key file")
buildbotBackend = flag.String("buildbot_backend", "", "Build bot status backend URL")
buildbotHost = flag.String("buildbot_host", "", "Hostname to map to the buildbot_backend. If an HTTP request with this hostname is received, it proxies to buildbot_backend.")
alsoRun = flag.String("also_run", "", "Optional path to run as a child process. (Used to run camlistore.org's ./scripts/run-blob-server)")
buildbotBackend = flag.String("buildbot_backend", "", "[optional] Build bot status backend URL")
buildbotHost = flag.String("buildbot_host", "", "[optional] Hostname to map to the buildbot_backend. If an HTTP request with this hostname is received, it proxies to buildbot_backend.")
alsoRun = flag.String("also_run", "", "[optiona] Path to run as a child process. (Used to run camlistore.org's ./scripts/run-blob-server)")
gceProjectID = flag.String("gce_project_id", "", "GCE project ID; required if not running on GCE and gce_log_name is specified.")
gceLogName = flag.String("gce_log_name", "", "GCE Cloud Logging log name; if non-empty, logs go to Cloud Logging instead of Apache-style local disk log files")
gceJWTFile = flag.String("gce_jwt_file", "", "If non-empty, a filename to the GCE Service Account's JWT (JSON) config file.")
gitContainer = flag.Bool("git_container", false, "Use git in the camlistore/git Docker container.")
gitContainer = flag.Bool("git_container", false, "Use git from the `camlistore/git` Docker container; if false, the system `git` is used.")
)
var (
@ -735,6 +735,7 @@ func main() {
WriteTimeout: 30 * time.Minute,
}
go func() {
log.Printf("Listening for HTTP on %v", *httpAddr)
errc <- httpServer.ListenAndServe()
}()
@ -763,6 +764,7 @@ func serveHTTPS(ctx context.Context, httpServer *http.Server) error {
httpsServer.TLSConfig = &tls.Config{
Certificates: []tls.Certificate{*cert},
}
log.Printf("Listening for HTTPS on %v", *httpsAddr)
ln, err := net.Listen("tcp", *httpsAddr)
if err != nil {
return err

View File

@ -33,9 +33,9 @@ import (
)
var (
emailNow = flag.String("email_now", "", "If non-empty, this commit hash is emailed immediately, without starting the webserver.")
smtpServer = flag.String("smtp_server", "127.0.0.1:25", "SMTP server")
emailsTo = flag.String("email_dest", "", "If non-empty, the email address to email commit emails.")
emailNow = flag.String("email_now", "", "[debug] if non-empty, this commit hash is emailed immediately, without starting the webserver.")
smtpServer = flag.String("smtp_server", "127.0.0.1:25", "[optional] SMTP server for sending emails on new commits.")
emailsTo = flag.String("email_dest", "", "[optional] The email address for new commit emails.")
)
func startEmailCommitLoop(errc chan<- error) {