Skip to content
Snippets Groups Projects
Commit cdc785b6 authored by Kamil Trzciński's avatar Kamil Trzciński
Browse files

Merge branch 'add_show_version' into 'master'

Add version flag.

It is handy to have only the version with revision printed out.

Also useful for omnibus-gitlab#1213

See merge request !5
parents b0ac2a7d c76f6213
No related branches found
No related tags found
1 merge request!5Add version flag.
Pipeline #
package main
 
import (
"net/http"
"fmt"
"net/http"
)
 
const predefined404 = `
Loading
Loading
Loading
Loading
@@ -27,8 +27,7 @@ fmt:
go fmt ./... | awk '{ print "Please run go fmt"; exit 1 }'
 
vet:
go get golang.org/x/tools/cmd/vet
go vet
go tool vet *.go
 
lint:
go get github.com/golang/lint/golint
Loading
Loading
Loading
Loading
@@ -2,12 +2,12 @@ package main
 
import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"mime"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"net/http/httptest"
"github.com/stretchr/testify/require"
"mime"
)
 
func TestGroupServeHTTP(t *testing.T) {
Loading
Loading
Loading
Loading
@@ -15,6 +15,7 @@ var VERSION = "dev"
var REVISION = "HEAD"
 
func appMain() {
var showVersion = flag.Bool("version", false, "Show version")
var listenHTTP = flag.String("listen-http", "", "The address to listen for HTTP requests")
var listenHTTPS = flag.String("listen-https", "", "The address to listen for HTTPS requests")
var listenProxy = flag.String("listen-proxy", "", "The address to listen for proxy requests")
Loading
Loading
@@ -27,9 +28,12 @@ func appMain() {
var daemonUID = flag.Uint("daemon-uid", 0, "Drop privileges to this user")
var daemonGID = flag.Uint("daemon-gid", 0, "Drop privileges to this group")
 
flag.Parse()
printVersion(*showVersion, VERSION)
log.Printf("GitLab Pages Daemon %s (%s)", VERSION, REVISION)
log.Printf("URL: https://gitlab.com/gitlab-org/gitlab-pages\n")
flag.Parse()
 
err := os.Chdir(*pagesRoot)
if err != nil {
Loading
Loading
@@ -75,6 +79,14 @@ func appMain() {
runApp(config)
}
 
func printVersion(showVersion bool, version string) {
if showVersion {
log.SetFlags(0)
log.Printf(version)
os.Exit(0)
}
}
func main() {
log.SetOutput(os.Stderr)
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment