package config import ( "log" "os" "strconv" "github.com/joho/godotenv" ) type Config struct { APIURL string APIKey string SenderID string Recipient string MsgParts int Threads int RPS int DurationSec int RampUpSec int } func Load() Config { if err := godotenv.Load(); err != nil { log.Println("Warning: .env file not found, using environment variables") } return Config{ APIURL: mustEnv("SMS_API_URL"), APIKey: mustEnv("SMS_API_KEY"), SenderID: mustEnv("SMS_SENDER_ID"), Recipient: mustEnv("SMS_RECIPIENT"), MsgParts: envInt("SMS_MESSAGE_PARTS", 1), Threads: envInt("LOAD_TEST_THREADS", 10), RPS: envInt("LOAD_TEST_RPS", 50), DurationSec: envInt("LOAD_TEST_DURATION_SECS", 30), RampUpSec: envInt("LOAD_TEST_RAMP_UP_SECS", 5), } } func mustEnv(key string) string { val := os.Getenv(key) if val == "" { log.Fatalf("Required environment variable %s is not set", key) } return val } func envInt(key string, defaultVal int) int { val := os.Getenv(key) if val == "" { return defaultVal } n, err := strconv.Atoi(val) if err != nil { log.Fatalf("Invalid integer for %s: %s", key, val) } return n }