+
+ // Don't init anything when no argument or help option is set
+ if ctx.NArg() == 0 {
+ return nil
+ }
+ for _, a := range ctx.Args() {
+ switch a {
+ case "-h", "--h", "-help", "--help":
+ return nil
+ }
+ }
+
+ // Load config file if requested
+ confFile := ctx.String("config")
+ if confFile != "" {
+ if !common.Exists(confFile) {
+ exitError(1, "Error env config file not found")
+ }
+ // Load config file variables that will overwrite env variables
+ err := godotenv.Overload(confFile)
+ if err != nil {
+ exitError(1, "Error loading env config file "+confFile)
+ }
+ // Keep confFile settings in a map
+ EnvConfFileMap, err = godotenv.Read(confFile)
+ if err != nil {
+ exitError(1, "Error reading env config file "+confFile)
+ }
+ }
+