MCPcopy
hub / github.com/caddyserver/caddy / handleEnvFileFlag

Function handleEnvFileFlag

cmd/commandfuncs.go:752–767  ·  view source on GitHub ↗

handleEnvFileFlag loads the environment variables from the given --envfile flag if specified. This should be called as early in the command function.

(fl Flags)

Source from the content-addressed store, hash-verified

750// handleEnvFileFlag loads the environment variables from the given --envfile
751// flag if specified. This should be called as early in the command function.
752func handleEnvFileFlag(fl Flags) error {
753 var err error
754 var envfileFlag []string
755 envfileFlag, err = fl.GetStringSlice("envfile")
756 if err != nil {
757 return fmt.Errorf("reading envfile flag: %v", err)
758 }
759
760 for _, envfile := range envfileFlag {
761 if err := loadEnvFromFile(envfile); err != nil {
762 return fmt.Errorf("loading additional environment variables: %v", err)
763 }
764 }
765
766 return nil
767}
768
769// AdminAPIRequest makes an API request according to the CLI flags given,
770// with the given HTTP method and request URI. If body is non-nil, it will

Callers 4

cmdRunFunction · 0.85
cmdEnvironFunction · 0.85
cmdAdaptConfigFunction · 0.85
cmdValidateConfigFunction · 0.85

Calls 1

loadEnvFromFileFunction · 0.85

Tested by

no test coverage detected