No Description

Staffan Olsson 5762fa5415 added protobuilder support 10 months ago
example a9aaf759fe first commit from code from git.skogstorpet.nu/staffan/service 2 years ago
proto 5762fa5415 added protobuilder support 10 months ago
scripts 4c698de324 refactored pb and simplified building of pb stuff 1 year ago
.gitignore a9aaf759fe first commit from code from git.skogstorpet.nu/staffan/service 2 years ago
LICENSE a9aaf759fe first commit from code from git.skogstorpet.nu/staffan/service 2 years ago
README.md a9aaf759fe first commit from code from git.skogstorpet.nu/staffan/service 2 years ago
client.go a582a62b99 close #1 2 years ago
env.pb.go 5762fa5415 added protobuilder support 10 months ago
env_grpc.pb.go 4c698de324 refactored pb and simplified building of pb stuff 1 year ago
environ.go 0046139739 fixed GoVersion and some formatting issues 2 years ago
go.mod a9aaf759fe first commit from code from git.skogstorpet.nu/staffan/service 2 years ago
go.sum a9aaf759fe first commit from code from git.skogstorpet.nu/staffan/service 2 years ago
protobuilder.yaml 5762fa5415 added protobuilder support 10 months ago
server.go c44eb453e9 Server show correct APIVersion now 2 years ago

README.md

environ

A simple lib to retrieve build time environment for client and server.

Usage

go get -u git.skogstorpet.nu/staffan/environ

The server should implement the EnvironmentSvc service. Given a grpc connection to the server, the client should be able to fetch the environment from the server.

To build an enviorn aware executable, build using these build settings:


# Version of program could be set by a git tag.
export VERSION=$(git describe --tags)
export GIT_COMMIT=$(git rev-list -1 HEAD --abbrev-commit)
export BUILD_TIME="$(date +%FT%T)"
export GO_OS_ARCH="$(go env GOOS)/$(go env GOARCH)"
export API_VERSION=$(cat $PROJ_ROOT/api.version)

echo "Version: $VERSION"
echo "GIT_COMMIT: $GIT_COMMIT"
echo "BUILD_TIME: $BUILD_TIME"
echo "GO_OS_ARCH: $GO_OS_ARCH"
echo "API_VERSION: $API_VERSION"

export LD_FLAGS="-X git.skogstorpet.nu/staffan/environ.GitCommit=$GIT_COMMIT \
    -X git.skogstorpet.nu/staffan/environ.BuildTime=$BUILD_TIME \
    -X git.skogstorpet.nu/staffan/environ.GoOsArch=$GO_OS_ARCH \
    -X git.skogstorpet.nu/staffan/environ.Version=$VERSION \
    -X git.skogstorpet.nu/staffan/environ.APIVersion=$API_VERSION"

# Build CLI
go build -ldflags "$LD_FLAGS" /your/path/to/client_main.go

# Build server
go build -ldflags "$LD_FLAGS" /your/path/to/server_main.go