Skip to content

Commit

Permalink
chore: add a script to obfuscate json files (grafana#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
eh-am authored Aug 3, 2022
1 parent a9fd5ac commit f5992a7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/obfuscate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require('fs');
const args = process.argv.slice(2);

if (args.length != 1) {
console.error('Usage ./obfuscate [filepath]');
process.exit(1);
}
// TODO(eh-am): read from stdin if available
const filename = args[0];
const data = JSON.parse(fs.readFileSync(filename));

function randomName() {
let r = (Math.random() + 1).toString(36).substring(7);
return r;
}

data.metadata.name = randomName();
data.flamebearer.names = data.flamebearer.names.map(randomName);

console.log(JSON.stringify(data));

0 comments on commit f5992a7

Please sign in to comment.