diff --git a/services/integration_tests/Cargo.toml b/services/integration_tests/Cargo.toml index e7974ab6d..a45ef27ef 100644 --- a/services/integration_tests/Cargo.toml +++ b/services/integration_tests/Cargo.toml @@ -38,6 +38,9 @@ uuid = { workspace = true, features = ["v4"] } # Time handling chrono = { workspace = true } +# Environment variables +dotenvy = "0.15" + [dev-dependencies] # Test utilities serial_test.workspace = true diff --git a/services/integration_tests/tests/common/auth_helpers.rs b/services/integration_tests/tests/common/auth_helpers.rs index 837ecc8eb..7c5ba2d09 100644 --- a/services/integration_tests/tests/common/auth_helpers.rs +++ b/services/integration_tests/tests/common/auth_helpers.rs @@ -200,6 +200,9 @@ impl TestAuthConfig { /// 2. Set JWT_SECRET in .env file /// 3. Load .env before running tests (e.g., `source .env` or use dotenv) pub fn get_test_jwt_secret() -> String { + // Load .env file for JWT_SECRET (idempotent, safe to call multiple times) + let _ = dotenvy::dotenv(); + std::env::var("JWT_SECRET").expect( "FATAL: JWT_SECRET must be set in .env file for E2E tests\n\ \n\