diff --git a/README.md b/README.md index 5e992fd0..e68fa364 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,7 @@ All Vouch Proxy configuration items are documented in [config/config.yml_example - [set `HTTP_PROXY` to relay Vouch Proxy IdP requests through an outbound proxy server](https://github.com/vouch/vouch-proxy/issues/291) - [Reverse Proxy for Google Cloud Run Services](https://github.com/karthikv2k/oauth_reverse_proxy) - [Enable native TLS in Vouch Proxy](https://github.com/vouch/vouch-proxy/pull/332#issue-522612010) +- [FreeBSD support](https://github.com/vouch/vouch-proxy/issues/368) Please do help us to expand this list. diff --git a/do.sh b/do.sh index c98b017d..5de70df8 100755 --- a/do.sh +++ b/do.sh @@ -18,13 +18,21 @@ NAME=vouch-proxy HTTPPORT=9090 GODOC_PORT=5050 -#--YetAnotherBugHunter 02/20/21 -#-- Added function Hostname() to hide -#-- the detail of querying for a host's -#-- fully-qualified domain name since how -#-- this is done can vary based on the OS. +run () { + go run main.go +} - Hostname() { +build () { + local VERSION=$(git describe --always --long) + local DT=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # ISO-8601 + local FQDN=$(_hostname) + local SEMVER=$(git tag --list --sort="v:refname" | tail -n -1) + local BRANCH=$(git rev-parse --abbrev-ref HEAD) + local UNAME=$(uname) + go build -i -v -ldflags=" -X main.version=${VERSION} -X main.uname=${UNAME} -X main.builddt=${DT} -X main.host=${FQDN} -X main.semver=${SEMVER} -X main.branch=${BRANCH}" . +} + +_hostname() { local FQDN local HOSTNAME_CMD @@ -34,8 +42,7 @@ GODOC_PORT=5050 esac FQDN=$($HOSTNAME_CMD) - #-- Can't test against $? since the assignment to FQDN always succeeds even if $HOSTNAME_CMD fails. - if [ "$FQDN" = "" ]; then + if [ -z "$FQDN" ]; then >&2 echo "error: Could determine the fully qualified domain name using command $HOSTNAME_CMD" return 1 fi @@ -43,19 +50,6 @@ GODOC_PORT=5050 return 0; } -run () { - go run main.go -} - -build () { - local VERSION=$(git describe --always --long) - local DT=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # ISO-8601 - local FQDN=$(Hostname) - local SEMVER=$(git tag --list --sort="v:refname" | tail -n -1) - local BRANCH=$(git rev-parse --abbrev-ref HEAD) - go build -i -v -ldflags=" -X main.version=${VERSION} -X main.builddt=${DT} -X main.host=${FQDN} -X main.semver=${SEMVER} -X main.branch=${BRANCH}" . -} - install () { cp ./vouch-proxy ${GOPATH}/bin/vouch-proxy } @@ -346,7 +340,6 @@ profile() { go tool pprof -http=0.0.0.0:19091 http://0.0.0.0:9090/debug/pprof/profile?seconds=10 } - gofmt() { # segfault's without exec since it would just call this function infinitely :) exec gofmt -w -s . diff --git a/main.go b/main.go index d7314f82..b9ce660d 100644 --- a/main.go +++ b/main.go @@ -56,6 +56,7 @@ var ( host = "undefined" semver = "undefined" branch = "undefined" + uname = "undefined" staticDir = "/static/" logger *zap.SugaredLogger fastlog *zap.Logger @@ -122,6 +123,7 @@ func main() { // "semver": semver, "version", version, "buildtime", builddt, + "uname", uname, "buildhost", host, "branch", branch, "semver", semver,