github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/opts/envfile.go (about)

     1  package opts
     2  
     3  import (
     4  	"os"
     5  )
     6  
     7  // ParseEnvFile reads a file with environment variables enumerated by lines
     8  //
     9  // “Environment variable names used by the utilities in the Shell and
    10  // Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase
    11  // letters, digits, and the '_' (underscore) from the characters defined in
    12  // Portable Character Set and do not begin with a digit. *But*, other
    13  // characters may be permitted by an implementation; applications shall
    14  // tolerate the presence of such names.”
    15  // -- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
    16  //
    17  // As of #16585, it's up to application inside docker to validate or not
    18  // environment variables, that's why we just strip leading whitespace and
    19  // nothing more.
    20  func ParseEnvFile(filename string) ([]string, error) {
    21  	return parseKeyValueFile(filename, os.LookupEnv)
    22  }