You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/guides/use-case/wiremock.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,6 +159,26 @@ Follow the steps to setup a non-containerized Node application:
159
159
}
160
160
```
161
161
162
+
> [!TIP]
163
+
> For the production environment, it's recommended not to expose API keys details in logs. Instead, you can log a placeholder message to indicate whether the API key is loaded:
164
+
165
+
```
166
+
constAPI_KEY=process.env.ACCUWEATHER_API_KEY;
167
+
168
+
console.log('API_ENDPOINT_BASE:', API_ENDPOINT_BASE); // Log after it's defined
169
+
console.log('ACCUWEATHER_API_KEY is set:', !!API_KEY); // Log a boolean value instead of the actual key
170
+
171
+
if (!API_ENDPOINT_BASE) {
172
+
thrownewError("API_ENDPOINT_BASE is not defined in environment variables");
173
+
}
174
+
175
+
// Only check for API key if not using WireMock
176
+
if (API_ENDPOINT_BASE!=='http://localhost:8080'&&!API_KEY) {
177
+
thrownewError("ACCUWEATHER_API_KEY is not defined in environment variables");
178
+
}
179
+
```
180
+
181
+
> This approach ensures that you only log whether the key is set without revealing its value.
0 commit comments