Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitbucket.org/heapsapp/envflag

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitbucket.org/heapsapp/envflag

  • v1.0.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

envflag

Package envflag is a Go package that exposes environment variables for all the flags within a flag.FlagSet.

GoDoc

It came out of a response to a Reddit post by jalquiza about their envy package.

This package differs from that one in several ways:

  • the usage is slightly different, it is not a drop in replacement

  • it can be used with any flag.FlagSet, not just flag.CommandLine

  • it tries harder (compared to the original envy) to avoid effecting the reported argument defaults or the results of functions/methods such as flag.Visit and flag.NFlag

  • if there are any errors parsing environment variables (e.g. a string value where an interger value is expected) the first such encountered is returned

See the GoDoc documentation for complete examples but basically you can just replace the call to:

    flag.Parse()

with:

    envflag.Parse("PROGNAME", true)

to have envirment variables such as PROGNAME_PORT be used for the program's -port argument when no such argument is provided.

This package is Copyright 2017, Dave Chapeskie.

You are free to do with it anything you want, with the sole exception being you cannot replicate this package and claim you wrote it.

FAQs

Package last updated on 12 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc