core/environment/environment.go
Vitaliy Pavlov 2c4eaf6809 stage WIP
2024-08-23 20:57:09 +07:00

30 lines
479 B
Go

package environment
import (
"log"
"os"
"strconv"
"time"
"github.com/joho/godotenv"
)
var ReconnectionInterval time.Duration
func Load() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
if recon, err := strconv.Atoi(os.Getenv("RECONNECT_INTERVAL")); err == nil {
ReconnectionInterval = time.Duration(recon) * time.Millisecond
} else {
log.Fatal("[AMQP]", err)
}
}
func IsDebug() bool {
return os.Getenv("DEBUG") == "true"
}