func GetOrDefaultSecond(envVar string, defaultValue time.Duration) time.Duration {
	v := GetOrDefaultInt(envVar, -1)
	if v < 0 {
		return defaultValue
	}
	return time.Duration(v) * time.Second
}
GetOrDefaultSecond returns the given environment variable value as an time.Duration (second).
Returns the default if the envvar cannot be coopered to an int, or is not found.
package env
import (
	"errors"
	"fmt"
	"os"
	"strconv"
	"strings"
	"time"
	"github.com/go-acme/lego/v4/log"
)
func Get(names ...string) (map[string]string, error) {
	values := map[string]string{}
	var missingEnvVars []string
	for _, envVar := range names {
		value := GetOrFile(envVar)
		if value == "" {
			missingEnvVars = append(missingEnvVars, envVar)
		}
		values[envVar] = value
	}
	if len(missingEnvVars) > 0 {
		return nil, fmt.Errorf("some credentials information are missing: %s", strings.Join(missingEnvVars, ","))
	}
	return values, nil
}
func GetWithFallback(groups ...[]string) (map[string]string, error) {
	values := map[string]string{}
	var missingEnvVars []string
	for _, names := range groups {
		if len(names) == 0 {
			return nil, errors.New("undefined environment variable names")
		}
		value, envVar := getOneWithFallback(names[0], names[1:]...)
		if value == "" {
			missingEnvVars = append(missingEnvVars, envVar)
			continue
		}
		values[envVar] = value
	}
	if len(missingEnvVars) > 0 {
		return nil, fmt.Errorf("some credentials information are missing: %s", strings.Join(missingEnvVars, ","))
	}
	return values, nil
}
func getOneWithFallback(main string, names ...string) (string, string) {
	value := GetOrFile(main)
	if len(value) > 0 {
		return value, main
	}
	for _, name := range names {
		value := GetOrFile(name)
		if len(value) > 0 {
			return value, main
		}
	}
	return "", main
}
func GetOrDefaultInt(envVar string, defaultValue int) int {
	v, err := strconv.Atoi(GetOrFile(envVar))
	if err != nil {
		return defaultValue
	}
	return v
}