Node.js and "Secrets"

Can I change the Replit tool Secrets variable in node.js?
If you can, please tell me how :pray:.
Template:node.js(official)
Environment:Normal Replit (not Core).

Hi, it sounds like your struggling with secrets, specifically in NodeJS.

You can navigate to the secrets pane by looking for the secrets icon in the tools section at the underneath your file hierarchy:

Clicking that will open up the secrets pane:

To save a secret click ‘New Secret’ in the top right hand side of the pane, then enter its name and value:

And your secret is securely stored!

To access any secret you set with your code, you can use process.env:

process.env["YOUR_SECRET"];

process.env is essentially just an object storing your secrets.

3 Likes

Can I change the pre-set Secrets in node.js?

I’m not sure I fully understand what you mean, you can change any secrets that appear in that secrets pane. As far as I am aware there are no pre-set secrets.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.