-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathgenerate-uuid.js
More file actions
43 lines (35 loc) · 1.08 KB
/
generate-uuid.js
File metadata and controls
43 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env node
/**
* UUID Generator Script
*
* This script generates secure UUIDs for use with FoxCloud.
*
* Usage:
* node scripts/generate-uuid.js [count]
*
* Examples:
* node scripts/generate-uuid.js # Generate 1 UUID
* node scripts/generate-uuid.js 5 # Generate 5 UUIDs
*/
import { randomUUID } from 'crypto';
// Get the number of UUIDs to generate from command line arguments
const count = process.argv[2] ? parseInt(process.argv[2], 10) : 1;
// Validate the count
if (isNaN(count) || count <= 0) {
console.error('Please provide a valid positive number');
process.exit(1);
}
// Generate and display UUIDs
console.log(`Generating ${count} UUID(s):\n`);
const uuids = [];
for (let i = 0; i < count; i++) {
const uuid = randomUUID();
uuids.push(uuid);
console.log(`${i + 1}. ${uuid}`);
}
// If generating multiple UUIDs, also show comma-separated format
if (count > 1) {
console.log('\nComma-separated format for wrangler.toml:');
console.log(`UUID = "${uuids.join(',')}"`);
}
console.log('\nThese UUIDs can be used in your FoxCloud configuration.');