Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 809 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 809 Bytes

go-envdata

go-envdata packages environment variables into Go binaries. Inspired by go-bindata.

Tries to be shell/OS-agnostic, but currently tested with bash and *nix systems.

Usage

Step 1: generate code

Capture ambient environment:

go-envdata -pkg env -o env/env.go

Capture environment defined by config file:

env -i PATH=$PATH bash -c 'source my-config.sh; go-envdata;

or

env -i PATH=$PATH bash -c "./setup-environment.sh; go-envdata"

where my-config.sh and setup-environment.sh are files you define to setup the environment variables.

Step 2: import generated code

Include the following import in files that reference the environment.

import _ "path/to/package/of/generated/file"