-
Notifications
You must be signed in to change notification settings - Fork 0
Update environment configuration for testing and production #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update environment configuration for testing and production #14
Conversation
- Introduced a separate test environment configuration in `src/core/test-env.ts` to isolate test-specific variables from production settings. - Updated test scripts to utilize the new test environment variables, enhancing clarity and maintainability. - Added documentation in `README.md` to outline the new environment configuration structure.
|
Caution Review failedThe pull request is closed. WalkthroughA new test-specific environment configuration module was introduced, isolating variables used exclusively for testing. The main environment configuration was updated to remove these test-related variables. Documentation was added to clarify this separation, and test scripts were updated to use the new test environment module. Changes
Sequence Diagram(s)sequenceDiagram
participant TestRunner as Test Script
participant testEnv as test-env.ts
participant env as env.ts
TestRunner->>testEnv: Import test-specific variables (APIURL, USERNAME, etc.)
TestRunner->>env: Import production variables (if needed)
Note over TestRunner: Test scripts use only testEnv for test variables
Note over env: Production code uses env (without test variables)
Possibly related issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
scripts/test/api.ts (1)
8-14: DestructuretestEnvinstead of repeating assignmentsSeven back-to-back lines perform one-to-one re-assignments that can be removed entirely by destructuring once. This trims noise and avoids a drift between the constant names and the source keys.
-import { testEnv } from "@/core/test-env"; - -const APIURL = testEnv.APIURL; -const USERNAME = testEnv.USERNAME; -const EMAIL = testEnv.EMAIL; -const PASSWORD = testEnv.PASSWORD; -const POSTMAN_COLLECTION = testEnv.POSTMAN_COLLECTION; +import { testEnv } from "@/core/test-env"; +const { + APIURL, + USERNAME, + EMAIL, + PASSWORD, + POSTMAN_COLLECTION, +} = testEnv;src/core/test-env.ts (1)
5-15: Add stronger validation for URL & e-mail fields
APIURLandelysia-envsupports.url()/.email()helpers (or.regex()fallback) giving early feedback when a test runner mis-configures these values.- APIURL: t.String({ default: "http://localhost:3000/api" }), - EMAIL: t.String({ default: "jake@jake.jake" }), + APIURL: t.URL({ default: "http://localhost:3000/api" }), + EMAIL: t.String().email({ default: "jake@jake.jake" }),README.md (1)
24-29: Reference.env.testearlier to avoid reader confusionNice addition! A quick pointer to the
.env.testworkflow right here would save new contributors a scroll-hunt and make the section self-contained.-Test-specific environment variables are now defined in `src/core/test-env.ts` and are only used by test scripts and test runners. This keeps test configuration isolated from production config. +Test-specific environment variables are now defined in `src/core/test-env.ts` and are only used by test scripts and test runners. This keeps test configuration isolated from production config. + +> **Note:** If you need to override any defaults, copy `.env.test.example` to `.env.test` and adjust as required before running tests.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
README.md(1 hunks)scripts/test/api.ts(2 hunks)src/core/env.ts(0 hunks)src/core/test-env.ts(1 hunks)
💤 Files with no reviewable changes (1)
- src/core/env.ts
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, there's a local copy strategy for the Postman collection where `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` pointing to a local copy, providing a fallback for testing scenarios while the main env.ts uses the remote GitHub URL as default.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:22-24
Timestamp: 2025-07-04T15:34:10.224Z
Learning: In the bepstack project, hardcoded test credentials in environment configuration files are acceptable and don't need to be flagged as security issues.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the .env.test.example file contains `POSTMAN_COLLECTION=./scripts/test/Conduit.postman_collection.json` pointing to a local copy in the scripts/test directory, not the tests directory as initially assumed.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` as a planned local fallback strategy, but the tests directory and local Postman collection file need to be created to complete the implementation.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the local fallback strategy for POSTMAN_COLLECTION is now fully implemented with the file existing at scripts/test/Conduit.postman_collection.json and .env.test.example correctly configured to use the local path.
README.md (5)
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, there's a local copy strategy for the Postman collection where `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` pointing to a local copy, providing a fallback for testing scenarios while the main env.ts uses the remote GitHub URL as default.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` as a planned local fallback strategy, but the tests directory and local Postman collection file need to be created to complete the implementation.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the .env.test.example file contains `POSTMAN_COLLECTION=./scripts/test/Conduit.postman_collection.json` pointing to a local copy in the scripts/test directory, not the tests directory as initially assumed.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:22-24
Timestamp: 2025-07-04T15:34:10.224Z
Learning: In the bepstack project, hardcoded test credentials in environment configuration files are acceptable and don't need to be flagged as security issues.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the local fallback strategy for POSTMAN_COLLECTION is now fully implemented with the file existing at scripts/test/Conduit.postman_collection.json and .env.test.example correctly configured to use the local path.
scripts/test/api.ts (5)
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, there's a local copy strategy for the Postman collection where `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` pointing to a local copy, providing a fallback for testing scenarios while the main env.ts uses the remote GitHub URL as default.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the .env.test.example file contains `POSTMAN_COLLECTION=./scripts/test/Conduit.postman_collection.json` pointing to a local copy in the scripts/test directory, not the tests directory as initially assumed.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` as a planned local fallback strategy, but the tests directory and local Postman collection file need to be created to complete the implementation.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the local fallback strategy for POSTMAN_COLLECTION is now fully implemented with the file existing at scripts/test/Conduit.postman_collection.json and .env.test.example correctly configured to use the local path.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:22-24
Timestamp: 2025-07-04T15:34:10.224Z
Learning: In the bepstack project, hardcoded test credentials in environment configuration files are acceptable and don't need to be flagged as security issues.
src/core/test-env.ts (3)
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, there's a local copy strategy for the Postman collection where `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` pointing to a local copy, providing a fallback for testing scenarios while the main env.ts uses the remote GitHub URL as default.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` as a planned local fallback strategy, but the tests directory and local Postman collection file need to be created to complete the implementation.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the .env.test.example file contains `POSTMAN_COLLECTION=./scripts/test/Conduit.postman_collection.json` pointing to a local copy in the scripts/test directory, not the tests directory as initially assumed.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
src/core/test-env.tsto isolate test-specific variables from production settings.README.mdto outline the new environment configuration structure.Summary by CodeRabbit
Documentation
Chores