Skip to content

Commit

Permalink
cli usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ARolek committed Jun 22, 2017
1 parent a1506b0 commit 5796068
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions cmd/tegola/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,41 @@ package main

import (
"flag"
"fmt"
"os"

"github.com/terranodo/tegola/server"
)

var (
configFile string
logFile string
logFormat string
port string
configFile = *flag.String("config", "config.toml", "")
logFile = *flag.String("log-file", "", "")
logFormat = *flag.String("log-format", server.DefaultLogFormat, "")
port = *flag.String("port", defaultHTTPPort, "")
)

const defaultHTTPPort = ":8080"

func init() {
flag.StringVar(&configFile, "config", "config.toml", "Location of config file in TOML format. Can be absolute, relative or remote over http(s).")
flag.StringVar(&logFile, "log-file", "", "The file to log output to. Disable by default.")
flag.StringVar(&logFormat, "log-format", server.DefaultLogFormat,
`The format that the logger will log with.
Available fields:
{{.Time}} : The current Date Time in RFC 2822 format.
{{.RequestIP}} : The IP address of the the requester.
{{.Z}} : The Zoom level.
{{.X}} : The X Coordinate.
{{.Y}} : The Y Coordinate.
`)
flag.StringVar(&port, "port", defaultHTTPPort, "Webserver port to bind to")
flag.Usage = func() {
fmt.Fprintf(os.Stderr, `tegola %v <http://tegola.io>
MVT tile server with support for PostGIS
USAGE: tegola [OPTIONS]
OPTIONS:
-h, --help Print usage
-v, --version Print version and quit
--config string Location of config file in TOML format. Can be local or remote over http(s) (default config.toml)
--port string Port to bind HTTP server to (example :8080)
--log-file string The file to write request logs to (default disabled)
--log-format string The format the logger will log with. Available fields:
{{.Time}} : The current Date Time in RFC 2822 format
{{.RequestIP}} : The IP address of the the requester
{{.Z}} : The Zoom level
{{.X}} : The X Coordinate
{{.Y}} : The Y Coordinate
`, Version)
}
}

0 comments on commit 5796068

Please sign in to comment.