From 26dde07ec058d4b59cefe1726a38521893eeec63 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Thu, 26 Dec 2013 11:00:50 -0800 Subject: [PATCH] add -version flag and goxc build config --- .gitignore | 2 ++ .goxc.json | 6 ++++++ imageproxy.go | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .goxc.json diff --git a/.gitignore b/.gitignore index 9ed3b07..3530f26 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +build +.goxc.local.json *.test diff --git a/.goxc.json b/.goxc.json new file mode 100644 index 0000000..4f83733 --- /dev/null +++ b/.goxc.json @@ -0,0 +1,6 @@ +{ + "ConfigVersion": "0.9", + "ArtifactsDest": "build", + "PackageVersion": "0.1", + "PrereleaseInfo": "snapshot" +} diff --git a/imageproxy.go b/imageproxy.go index 64353d9..9d03b3d 100644 --- a/imageproxy.go +++ b/imageproxy.go @@ -26,14 +26,28 @@ import ( "github.com/willnorris/go-imageproxy/proxy" ) +// goxc values +var ( + // VERSION is the version string for go-imageproxy. + VERSION string + // BUILD_DATE is the timestamp of when go-imageproxy was built. + BUILD_DATE string +) + var addr = flag.String("addr", "localhost:8080", "TCP address to listen on") var whitelist = flag.String("whitelist", "", "comma separated list of allowed remote hosts") var cacheDir = flag.String("cacheDir", "", "directory to use for file cache") +var version = flag.Bool("version", false, "print version information") func main() { flag.Parse() - fmt.Printf("go-imageproxy listening on %s\n", *addr) + if *version { + fmt.Printf("%v\nBuild: %v\n", VERSION, BUILD_DATE) + return + } + + fmt.Printf("go-imageproxy (version %v) listening on %s\n", VERSION, *addr) var c httpcache.Cache if *cacheDir != "" {