func initFromReaderConfigFile(reader io.Reader) error {
	btes, err := io.ReadAll(reader)
	if err != nil {
		return err
	}
	var configFileData ConfigFileData
	if err := yaml.Unmarshal(btes, &configFileData); err != nil {
		return err
	}
	if configFileData.Format != nil {
		format = *configFileData.Format
	}
	if configFileData.LibDir != nil {
		libDir = *configFileData.LibDir
	}
	if configFileData.OutputDir != nil {
		outputDir = *configFileData.OutputDir
	}
	if configFileData.StopOnFailure != nil {
		stopOnFailure = *configFileData.StopOnFailure
	}
	if configFileData.Variables != nil {
		for _, varFromFile := range *configFileData.Variables {
			variables = mergeVariables(varFromFile, variables)
		}
	}
	if configFileData.VariablesFiles != nil {
		for _, varFile := range *configFileData.VariablesFiles {
			if !isInArray(varFile, varFiles) {
				varFiles = append(varFiles, varFile)
			}
		}
	}
	if configFileData.Verbosity != nil {
		verbose = *configFileData.Verbosity
	}
	return nil
}
Configuration file overrides the environment variables.
package run
import (
	"context"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"runtime/pprof"
	"strconv"
	"strings"
	"time"
	"github.com/ghodss/yaml"
	"github.com/mitchellh/go-homedir"
	log "github.com/sirupsen/logrus"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
	"github.com/ovh/venom"
	"github.com/ovh/venom/executors/amqp"
	"github.com/ovh/venom/executors/dbfixtures"
	"github.com/ovh/venom/executors/exec"
	"github.com/ovh/venom/executors/grpc"
	"github.com/ovh/venom/executors/http"
	"github.com/ovh/venom/executors/imap"
	"github.com/ovh/venom/executors/kafka"
	"github.com/ovh/venom/executors/mqtt"
	"github.com/ovh/venom/executors/ovhapi"
	"github.com/ovh/venom/executors/rabbitmq"
	"github.com/ovh/venom/executors/readfile"
	"github.com/ovh/venom/executors/redis"
	"github.com/ovh/venom/executors/smtp"
	"github.com/ovh/venom/executors/sql"
	"github.com/ovh/venom/executors/ssh"
	"github.com/ovh/venom/executors/web"
)
var (
	path []string
	v    *venom.Venom
	variables     []string
	format        string
	varFiles      []string
	outputDir     string
	libDir        string
	stopOnFailure bool
	verbose       int
	variablesFlag     *[]string
	formatFlag        *string
	varFilesFlag      *[]string
	outputDirFlag     *string
	libDirFlag        *string
	stopOnFailureFlag *bool
	verboseFlag       *int
)
func init() {
	formatFlag = Cmd.Flags().String("format", "xml", "--format:yaml, json, xml, tap")
	stopOnFailureFlag = Cmd.Flags().Bool("stop-on-failure", false, "Stop running Test Suite on first Test Case failure")
	verboseFlag = Cmd.Flags().CountP("verbose", "v", "verbose. -vv to very verbose and -vvv to very verbose with CPU Profiling")
	varFilesFlag = Cmd.Flags().StringSlice("var-from-file", []string{""}, "--var-from-file filename.yaml --var-from-file filename2.yaml: yaml, must contains a dictionnary")
	variablesFlag = Cmd.Flags().StringArray("var", nil, "--var cds='cds -f config.json' --var cds2='cds -f config.json'")
	outputDirFlag = Cmd.PersistentFlags().String("output-dir", "", "Output Directory: create tests results file inside this directory")
	libDirFlag = Cmd.PersistentFlags().String("lib-dir", "", "Lib Directory: can contain user executors. example:/etc/venom/lib:$HOME/venom.d/lib")
}
func initArgs(cmd *cobra.Command) {
	if _, err := initFromEnv(os.Environ()); err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		os.Exit(2)
	}
	if err := initFromConfigFile(); err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		os.Exit(2)
	}
	cmd.LocalFlags().VisitAll(initFromCommandArguments)
}
func initFromCommandArguments(f *pflag.Flag) {
	if !f.Changed {
		return
	}
	switch f.Name {
	case "format":
		if formatFlag != nil {
			format = *formatFlag
		}
	case "stop-on-failure":
		if stopOnFailureFlag != nil {
			stopOnFailure = *stopOnFailureFlag
		}
	case "output-dir":
		if outputDirFlag != nil {
			outputDir = *outputDirFlag
		}
	case "lib-dir":
		if libDirFlag != nil {
			libDir = *libDirFlag
		}
	case "verbose":
		if verboseFlag != nil {
			verbose = *verboseFlag
		}
	case "var-from-file":
		if varFilesFlag != nil {
			for _, varFile := range *varFilesFlag {
				if !isInArray(varFile, varFiles) {
					varFiles = append(varFiles, varFile)
				}
			}
		}
	case "var":
		if variablesFlag != nil {
			for _, varFlag := range *variablesFlag {
				variables = mergeVariables(varFlag, variables)
			}
		}
	}
}
func fileExists(filename string) bool {
	info, err := os.Stat(filename)
	if os.IsNotExist(err) {
		return false
	}
	return !info.IsDir()
}
func initFromConfigFile() error {
	if fileExists(".venomrc") {
		fi, err := os.Open(".venomrc")
		if err != nil {
			return err
		}
		defer fi.Close()
		return initFromReaderConfigFile(fi)
	}
	home, err := homedir.Dir()
	if err != nil {
		return err
	}
	if fileExists(filepath.Join(home, ".venomrc")) {
		fi, err := os.Open(filepath.Join(home, ".venomrc"))
		if err != nil {
			return err
		}
		defer fi.Close()
		return initFromReaderConfigFile(fi)
	}
	return nil
}
type ConfigFileData struct {
	Format         *string   `json:"format,omitempty" yaml:"format,omitempty"`
	LibDir         *string   `json:"lib_dir,omitempty" yaml:"lib_dir,omitempty"`
	OutputDir      *string   `json:"output_dir,omitempty" yaml:"output_dir,omitempty"`
	StopOnFailure  *bool     `json:"stop_on_failure,omitempty" yaml:"stop_on_failure,omitempty"`
	Variables      *[]string `json:"variables,omitempty" yaml:"variables,omitempty"`
	VariablesFiles *[]string `json:"variables_files,omitempty" yaml:"variables_files,omitempty"`
	Verbosity      *int      `json:"verbosity,omitempty" yaml:"verbosity,omitempty"`
}