github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/scripts/obfuscate.js (about) 1 const fs = require('fs'); 2 const args = process.argv.slice(2); 3 4 if (args.length != 1) { 5 console.error('Usage ./obfuscate [filepath]'); 6 process.exit(1); 7 } 8 // TODO(eh-am): read from stdin if available 9 const filename = args[0]; 10 const data = JSON.parse(fs.readFileSync(filename)); 11 12 function randomName() { 13 let r = (Math.random() + 1).toString(36).substring(7); 14 return r; 15 } 16 17 data.metadata.name = randomName(); 18 data.flamebearer.names = data.flamebearer.names.map(randomName); 19 20 console.log(JSON.stringify(data));