@remits/remits-cli 0.1.93 → 0.1.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +20 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -288,22 +288,38 @@ function looksLikeDryRun(input) {
|
|
|
288
288
|
return value === true || value === 'true';
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
function isLocalBaseUrl(baseUrl) {
|
|
292
|
+
const normalized = normalizeBaseUrl(baseUrl || '');
|
|
293
|
+
return /:\/\/(localhost|127\.0\.0\.1|\[::1\])(?::|\/|$)/i.test(normalized);
|
|
294
|
+
}
|
|
295
|
+
|
|
291
296
|
/**
|
|
292
297
|
* One consistent banner across every surface that can touch production. Agents have repeatedly run a
|
|
293
298
|
* prod write believing they were in test mode, so the banner is loud, states the account it resolved,
|
|
294
299
|
* and distinguishes a live WRITE from a live read.
|
|
295
300
|
*/
|
|
296
301
|
function printProdDataBanner({ dataMode, accountId, baseUrl, operation, mutating = false, dryRun = false }) {
|
|
297
|
-
|
|
302
|
+
const normalizedDataMode = String(dataMode || '').toLowerCase();
|
|
303
|
+
const prodData = normalizedDataMode === 'prod';
|
|
304
|
+
const prodHost = baseUrl && !isLocalBaseUrl(baseUrl);
|
|
305
|
+
if (!prodData && !prodHost) return;
|
|
298
306
|
const bar = '='.repeat(72);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
307
|
+
let headline;
|
|
308
|
+
if (prodData) {
|
|
309
|
+
headline = dryRun
|
|
310
|
+
? 'PROD DATA — DRY RUN (no write will be attempted)'
|
|
311
|
+
: (mutating ? 'PROD DATA WRITE — this runs against LIVE production data' : 'PROD DATA READ — this reads LIVE production data');
|
|
312
|
+
} else {
|
|
313
|
+
headline = dryRun
|
|
314
|
+
? 'PROD HOST / TEST DATA — DRY RUN'
|
|
315
|
+
: (mutating ? 'PROD HOST / TEST DATA WRITE — deployed app, isolated test data' : 'PROD HOST / TEST DATA READ — deployed app, isolated test data');
|
|
316
|
+
}
|
|
302
317
|
console.log(bar);
|
|
303
318
|
console.log(' ' + headline);
|
|
304
319
|
console.log(' operation: ' + (operation || 'unknown'));
|
|
305
320
|
if (accountId != null) console.log(' account: ' + accountId);
|
|
306
321
|
if (baseUrl) console.log(' host: ' + normalizeBaseUrl(baseUrl));
|
|
322
|
+
console.log(' dataMode: ' + (normalizedDataMode || 'unknown'));
|
|
307
323
|
console.log(bar);
|
|
308
324
|
}
|
|
309
325
|
|