From 0e7667b2cf9b4c2d160d38b2884bd036a9440043 Mon Sep 17 00:00:00 2001 From: Julia Date: Sat, 16 Oct 2021 12:56:56 +0200 Subject: [PATCH] Initial Commit --- README.md | 14 +++++++++++++- example.js | 2 ++ tool.js | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 example.js create mode 100644 tool.js diff --git a/README.md b/README.md index 92d494f..9a0c8e5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ # NodeEnv -Using this tool you can store your code in a .env file, which you can deploy to repl.it and have your code be hidden! This currently only works with one file. \ No newline at end of file +Using this tool you can store your code in a .env file, which you can deploy to repl.it and have your code be hidden! This currently only works with one file. + +## Notes + +The code is very simple as this is currently just a "proof of concept". + +## Giving this "tool" a try + +Run `tool.js` with the input file as the argument. Example: `node tool.js example.js` The tool should spit out a JSON string. + +Go to Replit "Secrets", open the raw editor and paste it in. + +Now copy the contents from replit.js, create a new file in the Replit, named index.js and paste the contents in. \ No newline at end of file diff --git a/example.js b/example.js new file mode 100644 index 0000000..2b192d8 --- /dev/null +++ b/example.js @@ -0,0 +1,2 @@ +console.log(`It's a beautiful day, the sun is shining!`); +console.log(new Date().toLocaleDateString()); \ No newline at end of file diff --git a/tool.js b/tool.js new file mode 100644 index 0000000..dfc01ef --- /dev/null +++ b/tool.js @@ -0,0 +1,16 @@ +const fs = require(`fs`); +console.log(`Please note that this tool currently only supports one single file. It may be improved in the future.`); + +if (process.argv.length === 3) { + fs.readFile(process.argv[2], (error, data) => { + if (error) console.error(error); + else { + console.log(`Paste the following code into the Raw Secrets Editor:\n`) + console.log(JSON.stringify({ + code: data.toString(`base64`) + })); + } + }) +} else { + console.log(`Usage: `); +} \ No newline at end of file