From e448d78ade1ba5ee2700a7a9682f238b88cd86e5 Mon Sep 17 00:00:00 2001 From: Arpit Bhayani Date: Tue, 10 Dec 2024 14:58:35 +0530 Subject: [PATCH] Changing ENV ENVIRONMENT name --- .env.sample | 4 ++-- config/config.go | 4 ++-- internal/tests/integration/commands/commands_test.go | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.env.sample b/.env.sample index 77fc0b1..5276939 100644 --- a/.env.sample +++ b/.env.sample @@ -4,8 +4,8 @@ DICEDB_ADMIN_PASSWORD= DICEDB_ADDR=localhost:7380 DICEDB_USERNAME=dice DICEDB_PASSWORD= -SERVER_PORT=:8080 -IS_TEST_ENVIRONMENT=false +PORT=:8080 +ENVIRONMENT=production REQUEST_LIMIT_PER_MIN=1000 REQUEST_WINDOW_SEC=60 ALLOWED_ORIGINS=http://localhost:3000 diff --git a/config/config.go b/config/config.go index c24a152..f361dcd 100644 --- a/config/config.go +++ b/config/config.go @@ -70,8 +70,8 @@ func LoadConfig() *Config { AllowedOrigins []string CronCleanupFrequency time.Duration }{ - Port: getEnv("SERVER_PORT", ":8080"), - IsTestEnv: getEnvBool("IS_TEST_ENVIRONMENT", false), // Default server port + Port: getEnv("PORT", ":8080"), + IsTestEnv: getEnv("ENVIRONMENT", "local") != "production", // Default server port RequestLimitPerMin: getEnvInt("REQUEST_LIMIT_PER_MIN", 1000), // Default request limit RequestWindowSec: getEnvFloat64("REQUEST_WINDOW_SEC", 60), // Default request window in float64 AllowedOrigins: getEnvArray("ALLOWED_ORIGINS", []string{"http://localhost:3000"}), // Default allowed origins diff --git a/internal/tests/integration/commands/commands_test.go b/internal/tests/integration/commands/commands_test.go index 89a943a..5087c6b 100644 --- a/internal/tests/integration/commands/commands_test.go +++ b/internal/tests/integration/commands/commands_test.go @@ -29,8 +29,7 @@ func TestMain(m *testing.M) { } diceDBAddr := "localhost:" + port.Port() os.Setenv("DICEDB_ADDR", diceDBAddr) - - os.Setenv("IS_TEST_ENVIRONMENT", "true") + os.Setenv("ENVIRONMENT", "local") code := m.Run() os.Exit(code)