Skip to content

A small utility that packages up environment variables to ship with a Go binary

Notifications You must be signed in to change notification settings

beyang/go-envdata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

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"

About

A small utility that packages up environment variables to ship with a Go binary

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages