Skip to content

Commit

Permalink
Set env variable via env file
Browse files Browse the repository at this point in the history
  • Loading branch information
mpanne committed Feb 19, 2025
1 parent b2e70ad commit 67ab317
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/dito/.env.test
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ENCRYPTION_KEY="0123456789abcdef0123456789abcdef"
MOCK_EXTERNAL_APIS=true
5 changes: 4 additions & 1 deletion packages/dito/app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import { renderToPipeableStream } from "react-dom/server";
import logResponseStatus from "utils/logging";
import { NonceProvider } from "utils/nonce";

if (process.env.MOCK_EXTERNAL_APIS && process.env.NODE_ENV !== "production") {
if (
process.env.MOCK_EXTERNAL_APIS === "true" &&
process.env.NODE_ENV !== "production"
) {
const { mockServer } = await import("./mocks/node");
console.warn("Mock external APIs.");
mockServer.listen({
Expand Down
2 changes: 1 addition & 1 deletion packages/dito/tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dotenv.config({ path: path.resolve(__dirname, "../", ".env.test") });
const config: PlaywrightTestConfig = {
...baseConfig,
webServer: {
command: "MOCK_EXTERNAL_APIS=true npm run dev -- --port 5172",
command: "npm run dev -- --port 5172",
port: 5172,
timeout: parseInt(process.env.WAIT_ON_TIMEOUT ?? `${5 * 1000}`),
},
Expand Down

0 comments on commit 67ab317

Please sign in to comment.