{"repo":"jamiealquiza/envy","free":true,"listed":false,"github":"https://github.com/jamiealquiza/envy","clone":"git clone https://github.com/jamiealquiza/envy.git","description":"Envy automatically exposes environment variables for all of your Go flags","language":"Go","stars":154,"topics":["golang","library","go-packages","cli","flags","environment-variables","environment","env"],"license":"MIT","category":"cli-tools","readme_excerpt":"envy Automatically exposes environment variables for all of your flags. It supports the standard flags package along with limited support for Cobra commands. Envy takes a namespace prefix that will be used for environment variable lookups. Each flag registered in your app will be prefixed, uppercased, and hyphens exchanged for underscores; if a matching environment variable is found, it will set the respective flag value as long as the value is not otherwise explicitly set (see usage for precedence). Example: flag Code: Output: Example: Cobra Code: Output: Usage Variable precedence: Envy results in the following order of precedence, each item overwriting the previous: flag default - Envy generated env var - flag set at the CLI . Results referencing the stdlib flag example code: - ./example will result in port being set to 8131 - MYAPP PORT=5678 ./example will result in port being set to 5678 - MYAPP PORT=5678 ./example -port=1234 will result in port being set to 1234 Env vars in help output: Envy can update your app help output so that it includes the environment variable generated/referenced for each flag. This is done by calling envy.Parse() before flag.Parse() . The above example: If this isn't desired, simply call envy.Parse() after flag.Parse() : Satisfying types: Environment variables should be defined using a type that satisfies the respective type in your Go application's flag. For example: - string - APP ASTRINGVAR=\"someString\" - int - APP ANINTVAR=42 - bool - APP AB","default_branch":null,"files":null,"tree":[],"storefront":"/r/jamiealquiza","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jamiealquiza/envy/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}