Select Supported Platforms

Select Supported Architectures

Select Tier

Github Name

v0.1.2 · public · Published over 4 years ago

Asset Definition
Release Notes
Release Assets

withenv: runs commands with extra environment settings

It's just like envdir, but for go, and it reads files.


When I looked around, I couldn't find a tool for a small need: to run an application quickly with appropriate environment variables set, when no shell is available.

This particular use case helps running handlers in sensu-go, while secrets are not exposed to the API / web UI. Information about a file on a system is less threatening than seeing the actual secret set by an environment variable, which is not even redacted by the user interface.


usage: withenv PATH COMMAND [ARGS...]

Set environment variables defined in file PATH, and run COMMAND.

  -v       print program version
  -h       this help
  PATH     path to a file containing variable declarations in a KEY=VAL
           format. Spaces around KEY and VAL are NOT stripped. VAL has
                   variable expansion.
  COMMAND  next executable in line, which will be run with the newly set
           environment variables.
  ARGS...  any command line items are taken to COMMAND after variable

This tool can be used in sensu-go, chaining other commands for checks or handlers. Currently, both in asset and in Bonsai form, albeit this is still in the works.


This project is licensed under Blue Oak Model License v1.0.0. It is not registered either at OSI or GNU, therefore GitHub is widely looking at the other direction. However, this is the license I'm most happy with: you can read and understand it with no legal degree, and there are no hidden or cryptic meanings in it.

The project is also governed with Contributor Covenant's Code of Conduct in mind. I'm not copying it here, as a pledge for taking the verbatim version by the word, and we are not going to modify it in any way.

Any issues?

Open a ticket, perhaps a pull request. We support GitHub Flow. You might want to fork this project first.

Are you sure you want to report this asset?

Please describe the reason for reporting this asset. Our moderators will be notified and will disable the asset if it is found to be inappropriate.


You must be signed in to report this asset.

Sign In with Github



Either download the source code:

Download Source

Or download the asset definition: