envy.go
func Load(files ...string) error {

	// If no files received, load the default one
	if len(files) == 0 {
		err := godotenv.Overload()
		if err == nil {
			Reload()
		}
		return err
	}

	// We received a list of files
	for _, file := range files {

		// Check if it exists or we can access
		if _, err := os.Stat(file); err != nil {
			// It does not exist or we can not access.
			// Return and stop loading
			return err
		}

		// It exists and we have permission. Load it
		if err := godotenv.Overload(file); err != nil {
			return err
		}

		// Reload the env so all new changes are noticed
		Reload()

	}
	return nil
}
func Load(files ...string) error {

	// If no files received, load the default one
	if len(files) == 0 {
		err := godotenv.Overload()
		if err == nil {
			Reload()
		}
		return err
	}

	// We received a list of files
	for _, file := range files {

		// Check if it exists or we can access
		if _, err := os.Stat(file); err != nil {
			// It does not exist or we can not access.
			// Return and stop loading
			return err
		}

		// It exists and we have permission. Load it
		if err := godotenv.Overload(file); err != nil {
			return err
		}

		// Reload the env so all new changes are noticed
		Reload()

	}
	return nil
}
func Load ( files ... string ) error { // If no files received, load the default one if len ( files ) == 0 { err := godotenv . Overload ( ) if err == nil { Reload ( ) } return err } // We received a list of files for _ , file := range files { // Check if it exists or we can access if _ , err := os . Stat ( file ) ; err != nil { // It does not exist or we can not access. // Return and stop loading return err } // It exists and we have permission. Load it if err := godotenv . Overload ( file ) ; err != nil { return err } // Reload the env so all new changes are noticed Reload ( ) } return nil }
// Load .env files. Files will be loaded in the same order that are received.
// Redefined vars will override previously existing values.
// IE: envy.Load(".env", "test_env/.env") will result in DIR=test_env
// If no arg passed, it will try to load a .env file.
Load . env files . Files will be loaded in the same order that are received . Redefined vars will override previously existing values . IE : envy . Load ( . env test_env / . env ) will result in DIR = test_env If no arg passed it will try to load a . env file .